Skip to content

Commit

Permalink
ref[JS]: js protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysunxiao committed Jul 15, 2024
1 parent 2794348 commit b160d13
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
24 changes: 12 additions & 12 deletions protocol/src/main/resources/javascript/buffer/ByteBuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,26 +96,26 @@ const ByteBuffer = function() {
return this.writeOffset;
}

this.setWriteOffset = function(writeOffset) {
if (writeOffset > this.buffer.byteLength) {
throw new Error('index out of bounds exception: readerIndex: ' + this.readOffset +
', writerIndex: ' + this.writeOffset +
'(expected: 0 <= readerIndex <= writerIndex <= capacity:' + this.buffer.byteLength);
this.setWriteOffset = function(writeIndex) {
if (writeIndex > this.buffer.byteLength) {
throw new Error('writeIndex out of bounds exception: readOffset: ' + this.readOffset +
', writeOffset: ' + this.writeOffset +
'(expected: 0 <= readOffset <= writeOffset <= capacity:' + this.buffer.byteLength);
}
this.writeOffset = writeOffset;
this.writeOffset = writeIndex;
};

this.getReadOffset = function() {
return this.readOffset;
}

this.setReadOffset = function(readOffset) {
if (readOffset > this.writeOffset) {
throw new Error('index out of bounds exception: readerIndex: ' + this.readOffset +
', writerIndex: ' + this.writeOffset +
'(expected: 0 <= readerIndex <= writerIndex <= capacity:' + this.buffer.byteLength);
this.setReadOffset = function(readIndex) {
if (readIndex > this.writeOffset) {
throw new Error('readIndex out of bounds exception: readOffset: ' + this.readOffset +
', writeOffset: ' + this.writeOffset +
'(expected: 0 <= readOffset <= writeOffset <= capacity:' + this.buffer.byteLength);
}
this.readOffset = readOffset;
this.readOffset = readIndex;
};

this.getCapacity = function() {
Expand Down
24 changes: 12 additions & 12 deletions protocol/src/test/javascript/zfoojs/buffer/ByteBuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,26 +96,26 @@ const ByteBuffer = function() {
return this.writeOffset;
}

this.setWriteOffset = function(writeOffset) {
if (writeOffset > this.buffer.byteLength) {
throw new Error('index out of bounds exception: readerIndex: ' + this.readOffset +
', writerIndex: ' + this.writeOffset +
'(expected: 0 <= readerIndex <= writerIndex <= capacity:' + this.buffer.byteLength);
this.setWriteOffset = function(writeIndex) {
if (writeIndex > this.buffer.byteLength) {
throw new Error('writeIndex out of bounds exception: readOffset: ' + this.readOffset +
', writeOffset: ' + this.writeOffset +
'(expected: 0 <= readOffset <= writeOffset <= capacity:' + this.buffer.byteLength);
}
this.writeOffset = writeOffset;
this.writeOffset = writeIndex;
};

this.getReadOffset = function() {
return this.readOffset;
}

this.setReadOffset = function(readOffset) {
if (readOffset > this.writeOffset) {
throw new Error('index out of bounds exception: readerIndex: ' + this.readOffset +
', writerIndex: ' + this.writeOffset +
'(expected: 0 <= readerIndex <= writerIndex <= capacity:' + this.buffer.byteLength);
this.setReadOffset = function(readIndex) {
if (readIndex > this.writeOffset) {
throw new Error('readIndex out of bounds exception: readOffset: ' + this.readOffset +
', writeOffset: ' + this.writeOffset +
'(expected: 0 <= readOffset <= writeOffset <= capacity:' + this.buffer.byteLength);
}
this.readOffset = readOffset;
this.readOffset = readIndex;
};

this.getCapacity = function() {
Expand Down

0 comments on commit b160d13

Please sign in to comment.