public class InputStreamToWire extends Object
InputStream. The stream is expected to contain a
sequence of messages, each prefixed with its length as a 4-byte integer. The
payload of each message is read into an internal Bytes buffer and
presented through a Wire implementation for deserialisation.
The provided InputStream is not closed by this class; callers remain
responsible for its lifecycle. This class is useful when Chronicle Wire needs
to consume data from sources such as network sockets or files where frames are
delimited with explicit length prefixes.
Wire,
InputStream,
DataInputStream| Constructor and Description |
|---|
InputStreamToWire(WireType wireType,
InputStream is)
Creates a new instance configured with the given wire type and input
stream.
|
| Modifier and Type | Method and Description |
|---|---|
Wire |
readOne()
Reads the next length-prefixed message from the input stream and makes
it available through the internal
Wire instance. |
public InputStreamToWire(WireType wireType, InputStream is)
wireType - the WireType used to interpret the message
payloadsis - the InputStream from which data will be read.public Wire readOne() throws IOException
Wire instance. The wire and its
backing buffer are cleared before reading the 4-byte length header. A
negative length results in a StreamCorruptedException. After the
bytes are read, the wire is positioned at the start of the message
payload.Wire ready for deserialisation; the same
instance is reused for each callIOException - if an I/O error occursEOFException - if the stream ends unexpectedlyStreamCorruptedException - if a negative length is encounteredCopyright © 2026 Chronicle Software Ltd. All rights reserved.