|
554 | 554 | ByteBuffer.prototype.readInt8 = function(offset) {
|
555 | 555 | offset = typeof offset != 'undefined' ? offset : (this.offset+=1)-1;
|
556 | 556 | if (offset >= this.array.byteLength) {
|
557 |
| - throw(new Error("Cannot read int8 from "+this+": Capacity overflow")); |
| 557 | + throw(new Error("Cannot read int8 from "+this+" at "+offset+": Capacity overflow")); |
558 | 558 | }
|
559 | 559 | return this.view.getInt8(offset);
|
560 | 560 | };
|
|
603 | 603 | */
|
604 | 604 | ByteBuffer.prototype.readUint8 = function(offset) {
|
605 | 605 | offset = typeof offset != 'undefined' ? offset : (this.offset+=1)-1;
|
606 |
| - if (offset >= this.array.byteLength) { |
607 |
| - throw("Cannot read uint8 from "+this+": Capacity overflow"); |
| 606 | + if (offset+1 > this.array.byteLength) { |
| 607 | + throw("Cannot read uint8 from "+this+" at "+offset+": Capacity overflow"); |
608 | 608 | }
|
609 | 609 | return this.view.getUint8(offset);
|
610 | 610 | };
|
|
633 | 633 | ByteBuffer.prototype.readInt16 = function(offset) {
|
634 | 634 | offset = typeof offset != 'undefined' ? offset : (this.offset+=2)-2;
|
635 | 635 | if (offset+2 > this.array.byteLength) {
|
636 |
| - throw(new Error("Cannot read int16 from "+this+": Capacity overflow")); |
| 636 | + throw(new Error("Cannot read int16 from "+this+" at "+offset+": Capacity overflow")); |
637 | 637 | }
|
638 | 638 | return this.view.getInt16(offset, this.littleEndian);
|
639 | 639 | };
|
|
682 | 682 | ByteBuffer.prototype.readUint16 = function(offset) {
|
683 | 683 | offset = typeof offset != 'undefined' ? offset : (this.offset+=2)-2;
|
684 | 684 | if (offset+2 > this.array.byteLEngth) {
|
685 |
| - throw(new Error("Cannot read int16 from "+this+": Capacity overflow")); |
| 685 | + throw(new Error("Cannot read int16 from "+this+" at "+offset+": Capacity overflow")); |
686 | 686 | }
|
687 | 687 | return this.view.getUint16(offset, this.littleEndian);
|
688 | 688 | };
|
|
711 | 711 | ByteBuffer.prototype.readInt32 = function(offset) {
|
712 | 712 | offset = typeof offset != 'undefined' ? offset : (this.offset+=4)-4;
|
713 | 713 | if (offset+4 > this.array.byteLength) {
|
714 |
| - throw(new Error("Cannot read int32 from "+this+": Capacity overflow")); |
| 714 | + throw(new Error("Cannot read int32 from "+this+" at "+offset+": Capacity overflow")); |
715 | 715 | }
|
716 | 716 | return this.view.getInt32(offset, this.littleEndian);
|
717 | 717 | };
|
|
760 | 760 | ByteBuffer.prototype.readUint32 = function(offset) {
|
761 | 761 | offset = typeof offset != 'undefined' ? offset : (this.offset+=4)-4;
|
762 | 762 | if (offset+4 > this.array.byteLength) {
|
763 |
| - throw(new Error("Cannot read uint32 from "+this+": Capacity overflow")); |
| 763 | + throw(new Error("Cannot read uint32 from "+this+" at "+offset+": Capacity overflow")); |
764 | 764 | }
|
765 | 765 | return this.view.getUint32(offset, this.littleEndian);
|
766 | 766 | };
|
|
789 | 789 | ByteBuffer.prototype.readFloat32 = function(offset) {
|
790 | 790 | offset = typeof offset != 'undefined' ? offset : (this.offset+=4)-4;
|
791 | 791 | if (this.array == null || offset+4 > this.array.byteLength) {
|
792 |
| - throw(new Error("Cannot read float32 from "+this+": Capacity overflow")); |
| 792 | + throw(new Error("Cannot read float32 from "+this+" at "+offset+": Capacity overflow")); |
793 | 793 | }
|
794 | 794 | return this.view.getFloat32(offset, this.littleEndian);
|
795 | 795 | };
|
|
838 | 838 | ByteBuffer.prototype.readFloat64 = function(offset) {
|
839 | 839 | offset = typeof offset != 'undefined' ? offset : (this.offset+=8)-8;
|
840 | 840 | if (this.array == null || offset+8 > this.array.byteLength) {
|
841 |
| - throw(new Error("Cannot read float64 from "+this+": Capacity overflow")); |
| 841 | + throw(new Error("Cannot read float64 from "+this+" at "+offset+": Capacity overflow")); |
842 | 842 | }
|
843 | 843 | return this.view.getFloat64(offset, this.littleEndian);
|
844 | 844 | };
|
|
903 | 903 | offset = typeof offset != 'undefined' ? offset : (this.offset+=8)-8;
|
904 | 904 | if (this.array == null || offset+8 > this.array.byteLength) {
|
905 | 905 | this.offset -= 8;
|
906 |
| - throw(new Error("Cannot read int64 from "+this+": Capacity overflow")); |
| 906 | + throw(new Error("Cannot read int64 from "+this+" at "+offset+": Capacity overflow")); |
907 | 907 | }
|
908 | 908 | var value;
|
909 | 909 | if (this.littleEndian) {
|
|
954 | 954 | offset = typeof offset != 'undefined' ? offset : (this.offset+=8)-8;
|
955 | 955 | if (this.array == null || offset+8 > this.array.byteLength) {
|
956 | 956 | this.offset -= 8;
|
957 |
| - throw(new Error("Cannot read int64 from "+this+": Capacity overflow")); |
| 957 | + throw(new Error("Cannot read int64 from "+this+" at "+offset+": Capacity overflow")); |
958 | 958 | }
|
959 | 959 | var value;
|
960 | 960 | if (this.littleEndian) {
|
|
0 commit comments