BinReaderWriter
Overview
This class is used to serialize and deserialize any kind of data into the bytes buffer. It provides a lot of symmetrical read/write methods for each datatype, so you can easily write and read any objects to and from ByteStream. This class is used by the BinMessage to read/write data into the binary message. In most cases you do not need to deal with this class directly.
Location
- Reference: com.remobjects.sdk.jar
- Package: com.remobjects.sdk
- Ancestry: Object | BinReaderWriter
Instance Methods
constructor
Creates BinReaderWriter.
constructor
BinReaderWriter()
clear
Clears internal streams.
method clear
void clear()
clone
Creates copy of the BinReaderWriter.
method clone: Object
Object clone()
getInputStream
Returns input stream.
method getInputStream: ByteArrayInputStream
ByteArrayInputStream getInputStream()
getOutputStream
Returns output stream.
method getOutputStream: ByteArrayOutputStream
ByteArrayOutputStream getOutputStream()
readAnsiString
Reads the next value as AnsiString from the stream.
method readAnsiString: String
String readAnsiString()
readBoolean
Reads the next Int32 value from the stream as Boolean.
method readBoolean: Boolean
Boolean readBoolean()
readByte
Reads the next Byte value from the stream.
method readByte: SByte
SByte readByte()
readBytes (Integer): SByte[]
Reads the bytes buffer with the specified size.
method readBytes(aLength: Integer): array of SByte
SByte[] readBytes(Integer aLength)
Parameters:
- aLength: Given size.
readBytes (Integer, Integer): SByte[]
Reads the bytes buffer with the given size and offset.
method readBytes(aLength: Integer; aOffset: Integer): array of SByte
SByte[] readBytes(Integer aLength, Integer aOffset)
Parameters:
- aLength: Given size.
- aOffset: Given offset.
readCurrencyBigEndian
Reads the next currency value from the BE stream.
method readCurrencyBigEndian: BigDecimal
BigDecimal readCurrencyBigEndian()
readCurrencyLittleEndian
Reads the next currency value from the LE stream.
method readCurrencyLittleEndian: BigDecimal
BigDecimal readCurrencyLittleEndian()
readDateTime
Reads the next date value from the stream.
method readDateTime: Date
Date readDateTime()
readDecimalLittleEndian
Reads the next decimal value from the LE stream.
method readDecimalLittleEndian: BigDecimal
BigDecimal readDecimalLittleEndian()
readDoubleBigEndian
Reads the next double value from the BE stream.
method readDoubleBigEndian: Double
Double readDoubleBigEndian()
readDoubleLittleEndian
Reads the next double value from the LE stream.
method readDoubleLittleEndian: Double
Double readDoubleLittleEndian()
readEnum
Reads the next enum value from the stream.
method readEnum: Integer
Integer readEnum()
readGuid
Reads the next UUID value from the stream.
method readGuid: UUID
UUID readGuid()
readInt16BigEndian
Reads the next short value from the BE stream.
method readInt16BigEndian: SmallInt
SmallInt readInt16BigEndian()
readInt16LittleEndian
Reads the next short value from the LE stream.
method readInt16LittleEndian: SmallInt
SmallInt readInt16LittleEndian()
readInt32BigEndian
Reads the next int value from the BE stream.
method readInt32BigEndian: Integer
Integer readInt32BigEndian()
readInt32LittleEndian
Reads the next int value from the LE stream.
method readInt32LittleEndian: Integer
Integer readInt32LittleEndian()
readInt64BigEndian
Reads the next long value from the BE stream.
method readInt64BigEndian: Int64
Int64 readInt64BigEndian()
readInt64LittleEndian
Reads the next long value from the LE stream.
method readInt64LittleEndian: Int64
Int64 readInt64LittleEndian()
readSingleBigEndian
Reads the next float value from the BE stream.
method readSingleBigEndian: Single
Single readSingleBigEndian()
readSingleLittleEndian
Reads the next float value from the LE stream.
method readSingleLittleEndian: Single
Single readSingleLittleEndian()
readUtf8String
Reads the next value as UTF8String from the stream.
method readUtf8String: String
String readUtf8String()
readVariant
Reads the next VariantType value from the stream.
method readVariant(aValue: VariantType; aTypeCode: VariantTypeCode)
void readVariant(VariantType aValue, VariantTypeCode aTypeCode)
Parameters:
- aValue: Given VariantType object.
- aTypeCode: Given VariantTypeCode.
readWideString
Reads the next value as WideString from the stream.
method readWideString: String
String readWideString()
setInputStream
Sets given input stream.
method setInputStream(aStream: ByteArrayInputStream)
void setInputStream(ByteArrayInputStream aStream)
Parameters:
- aStream: Given stream.
setOutputStream
Set given output strream.
method setOutputStream(aStream: ByteArrayOutputStream)
void setOutputStream(ByteArrayOutputStream aStream)
Parameters:
- aStream: Given stream.
tryReadUtf8String
Reads a Utf8 string value from the stream. In contrast to the readUtf8String: method, this method does not throw an unexpectedStringLength exception when attempting to read nonexistent data at the end of the stream.
method tryReadUtf8String: String
String tryReadUtf8String()
writeAnsiString
Writes a String value into the stream as WideString.
method writeAnsiString(aValue: String)
void writeAnsiString(String aValue)
Parameters:
- aValue: Given value.
writeBoolean
Writes the given boolean value into the stream as Int32 value, where 0 is false and any other value is true.
method writeBoolean(aValue: Boolean)
void writeBoolean(Boolean aValue)
Parameters:
- aValue: Given value.
writeByte
Writes the given Byte value into the stream.
method writeByte(aValue: SByte)
void writeByte(SByte aValue)
Parameters:
- aValue: Given value.
writeBytes (SByte[], Integer)
Writes the bytes buffer with the given length into the stream.
method writeBytes(aBuffer: array of SByte; aLength: Integer)
void writeBytes(SByte[] aBuffer, Integer aLength)
Parameters:
- aBuffer: Given stream.
- aLength: Given count of bytes to be written.
writeBytes (SByte[], Integer, Integer)
Writes the bytes buffer with the given length and offset into the stream.
method writeBytes(aBuffer: array of SByte; aLength: Integer; aOffset: Integer)
void writeBytes(SByte[] aBuffer, Integer aLength, Integer aOffset)
Parameters:
- aBuffer: Given stream.
- aLength: Given count of bytes to be written.
- aOffset: Given offset for incoming buffer.
writeCurrencyBigEndian
Writes a Currency value into the BE stream.
method writeCurrencyBigEndian(aValue: BigDecimal)
void writeCurrencyBigEndian(BigDecimal aValue)
Parameters:
- aValue: Given value.
writeCurrencyLittleEndian
Currency value to be put into the LE stream
method writeCurrencyLittleEndian(aValue: BigDecimal)
void writeCurrencyLittleEndian(BigDecimal aValue)
Parameters:
- aValue: Given value.
writeDateTime
Writes a date value into the stream.
method writeDateTime(aValue: Date)
void writeDateTime(Date aValue)
Parameters:
- aValue: Given value.
writeDecimalLittleEndian
Writes a Decimal value into the LE stream.
method writeDecimalLittleEndian(aValue: BigDecimal)
void writeDecimalLittleEndian(BigDecimal aValue)
Parameters:
- aValue: Given value.
writeDoubleBigEndian
Writes a Double value into the BE stream.
method writeDoubleBigEndian(aValue: Double)
void writeDoubleBigEndian(Double aValue)
Parameters:
- aValue: Given value.
writeDoubleLittleEndian
Writes a Double value into the LE stream.
method writeDoubleLittleEndian(aValue: Double)
void writeDoubleLittleEndian(Double aValue)
Parameters:
- aValue: Given value.
writeEnum
Writes an enumeration item value into the stream.
method writeEnum(aValue: Integer)
void writeEnum(Integer aValue)
Parameters:
- aValue: Given value.
writeGuid
Writes a UUID value into the stream.
method writeGuid(aValue: UUID)
void writeGuid(UUID aValue)
Parameters:
- aValue: Given value.
writeInt16BigEndian
Writes an short value into the BE stream.
method writeInt16BigEndian(aValue: SmallInt)
void writeInt16BigEndian(SmallInt aValue)
Parameters:
- aValue: Given value.
writeInt16LittleEndian
Writes an short value into the LE stream.
method writeInt16LittleEndian(aValue: SmallInt)
void writeInt16LittleEndian(SmallInt aValue)
Parameters:
- aValue: Given value.
writeInt32BigEndian
Writes an int value into the BE stream.
method writeInt32BigEndian(aValue: Integer)
void writeInt32BigEndian(Integer aValue)
Parameters:
- aValue: Given value.
writeInt32LittleEndian
Writes an int value into the LE stream.
method writeInt32LittleEndian(aValue: Integer)
void writeInt32LittleEndian(Integer aValue)
Parameters:
- aValue: Given value.
writeInt64BigEndian
Writes an long value into the BE stream.
method writeInt64BigEndian(aValue: Int64)
void writeInt64BigEndian(Int64 aValue)
Parameters:
- aValue: Given value.
writeInt64LittleEndian
Writes an long value into the LE stream.
method writeInt64LittleEndian(aValue: Int64)
void writeInt64LittleEndian(Int64 aValue)
Parameters:
- aValue: Given value.
writeSingleBigEndian
Writes an float value into the BE stream.
method writeSingleBigEndian(aValue: Single)
void writeSingleBigEndian(Single aValue)
Parameters:
- aValue: Given value.
writeSingleLittleEndian
Writes an float value into the LE stream.
method writeSingleLittleEndian(aValue: Single)
void writeSingleLittleEndian(Single aValue)
Parameters:
- aValue: Given value.
writeUtf8String
Writes a string value into the stream as UTF8 String.
method writeUtf8String(aValue: String)
void writeUtf8String(String aValue)
Parameters:
- aValue: Given value.
writeWideString
Writes a String value into the stream as WideString.
method writeWideString(aValue: String)
void writeWideString(String aValue)
Parameters:
- aValue: Given value.