Skip to content

Commit

Permalink
ref[TypeScript]: TypeScript protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysunxiao committed Jul 15, 2024
1 parent 04d80e1 commit b1cbc73
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/typescript/buffer/ByteBuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,26 @@ class ByteBuffer implements IByteBuffer{
return this.buffer;
}

setWriteOffset(writeOffset: number): void {
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);
setWriteOffset(writeIndex: number): void {
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;
}

getWriteOffset(): number {
return this.writeOffset;
}

setReadOffset(readOffset: number): void {
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);
setReadOffset(readIndex: number): void {
if (readIndex > this.writeOffset) {
throw new Error('readIndex out of bounds exception:readIndex:' + this.readOffset +
', writeOffset:' + this.writeOffset +
'(expected:0 <= readOffset <= writeOffset <= capacity:' + this.buffer.byteLength + ')');
}
this.readOffset = readOffset;
this.readOffset = readIndex;
}

getReadOffset(): number {
Expand Down
24 changes: 12 additions & 12 deletions protocol/src/test/typescript/zfoots/buffer/ByteBuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,26 @@ class ByteBuffer implements IByteBuffer{
return this.buffer;
}

setWriteOffset(writeOffset: number): void {
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);
setWriteOffset(writeIndex: number): void {
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;
}

getWriteOffset(): number {
return this.writeOffset;
}

setReadOffset(readOffset: number): void {
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);
setReadOffset(readIndex: number): void {
if (readIndex > this.writeOffset) {
throw new Error('readIndex out of bounds exception:readIndex:' + this.readOffset +
', writeOffset:' + this.writeOffset +
'(expected:0 <= readOffset <= writeOffset <= capacity:' + this.buffer.byteLength + ')');
}
this.readOffset = readOffset;
this.readOffset = readIndex;
}

getReadOffset(): number {
Expand Down

0 comments on commit b1cbc73

Please sign in to comment.