Add doubles

This commit is contained in:
Bill 2021-12-04 15:38:38 -05:00
parent 0e8e291455
commit 69426ce0b5
3 changed files with 20 additions and 3 deletions

View File

@ -36,6 +36,15 @@ export class BinaryReader
return short; return short;
} }
public readDouble(): number
{
const double = this._dataView.getFloat64(this._position);
this._position += 8;
return double;
}
public readInt(): number public readInt(): number
{ {
const int = this._dataView.getInt32(this._position); const int = this._dataView.getInt32(this._position);
@ -59,4 +68,4 @@ export class BinaryReader
{ {
return this._dataView.buffer; return this._dataView.buffer;
} }
} }

View File

@ -38,6 +38,13 @@ export class EvaWireDataWrapper implements IMessageDataWrapper
return this._buffer.readShort(); return this._buffer.readShort();
} }
public readDouble(): number
{
if(!this._buffer) return -1;
return this._buffer.readDouble();
}
public readInt(): number public readInt(): number
{ {
if(!this._buffer) return -1; if(!this._buffer) return -1;
@ -62,4 +69,4 @@ export class EvaWireDataWrapper implements IMessageDataWrapper
{ {
return (this._buffer && (this._buffer.remaining() > 0)); return (this._buffer && (this._buffer.remaining() > 0));
} }
} }

View File

@ -6,8 +6,9 @@ export interface IMessageDataWrapper
readBytes(length: number): BinaryReader; readBytes(length: number): BinaryReader;
readBoolean(): boolean; readBoolean(): boolean;
readShort(): number; readShort(): number;
readDouble(): number;
readInt(): number; readInt(): number;
readString(): string; readString(): string;
header: number; header: number;
bytesAvailable: boolean; bytesAvailable: boolean;
} }