public class WireToOutputStream extends Object
OutputStream.
The class facilitates writing data to an OutputStream using the Wire format. It uses
an intermediate Bytes buffer to temporarily hold data in the Wire format
before flushing it to the actual OutputStream. The provided OutputStream is not
closed by this class
| Constructor and Description |
|---|
WireToOutputStream(WireType wireType,
OutputStream os)
Creates a new bridge for the given wire type and output stream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
flush()
Writes the data currently in the wire buffer to the underlying output
stream.
|
Wire |
getWire()
Returns the internal
Wire prepared for a new message. |
public WireToOutputStream(WireType wireType, OutputStream os)
wireType - the WireType used to serialise data into the
internal buffer (for example Binary, Text or JSON).os - the OutputStream to which length-prefixed messages
will be written when flush() is called. This
stream is not closed by this class.public Wire getWire()
Wire prepared for a new message.
The backing buffer is cleared before the wire is returned. Any data not yet flushed will be lost.
Wire ready for serialisation.public void flush()
throws IOException
A four byte length is written first, followed by the serialised bytes.
The content remains in the buffer until getWire() is called.
IOException - if an I/O error occurs while writing.Copyright © 2026 Chronicle Software Ltd. All rights reserved.