Messages only remain to support one-way messaging which is deprecated at this release. This interface will be removed in a future release.
@Deprecated public interface MessageReader
DataMessage
which
allows 'relative' reading of the message without affecting the original
message pointers.
It should be noted that as a Message Reader maintains a reference to the original message then the original message can not be garbage collected until the reader itself is no longer referenced.
Modifier and Type | Method and Description |
---|---|
DataMessage |
getMessage()
Deprecated.
Returns the message that this reader is for.
|
boolean |
hasRemaining()
Deprecated.
Indicates whether the message has any remaining data to read.
|
byte |
nextByte()
Deprecated.
Returns the next byte of data from the message.
|
void |
nextBytes(byte[] destination)
Deprecated.
Returns data from the message as bytes from the current position.
|
String |
nextField()
Deprecated.
Returns a field of string data from the current message position.
|
Record |
nextRecord()
Deprecated.
Returns a record of string data from the current message position.
|
int |
remaining()
Deprecated.
Indicates the number of unread data bytes remaining within the message.
|
void |
rewind()
Deprecated.
Resets the data pointer to the start of the data in preparation for
relative read ('next...') operations.
|
DataMessage getMessage()
byte nextByte() throws MessageException
The byte of data at the current position is returned and the position updated.
MessageException
- if unable to return the next byte of data.void nextBytes(byte[] destination) throws MessageException
Bytes from current message position are transferred into the specified destination array until the destination array is filled. The message position is then updated.
destination
- the destination array.MessageException
- if the destination array is too long.Record nextRecord() throws MessageException
This returns a record of String data read from the current data buffer position to the next record delimiter within the buffer or the end of the message.
Fields (areas delimited by field delimiters) are unpacked from within the record area. If there are no field delimiters then the returned record will contain only one field.
hasRemaining()
should be called before calling this method to
determine whether there is any data to read.
After calling this method the data buffer position will be moved beyond the record read.
MessageException
- if unable to obtain the next record.String nextField() throws MessageException
This returns a field of String data constructed from bytes read from the current data buffer position to the next field delimiter (or record delimiter) within the buffer or the end of the message.
hasRemaining()
should be called before calling this method to
determine whether there is any data to read.
After calling this method the data buffer pointer will be moved beyond the delimiter found.
MessageException
- if unable to read the next field from the
record.void rewind()
boolean hasRemaining()
int remaining()
Copyright © 2020 Push Technology Ltd. All Rights Reserved.