public class WireToOutputStream extends Object
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.
| Constructor and Description |
|---|
WireToOutputStream(WireType wireType,
OutputStream os)
Constructs a new instance with the specified WireType and OutputStream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
flush()
Flushes the data in Wire format to the underlying OutputStream.
|
Wire |
getWire()
Retrieves the Wire object for writing data.
|
public WireToOutputStream(WireType wireType, OutputStream os)
wireType - The type of Wire to be used.os - The OutputStream to which the data in Wire format will be written.public Wire getWire()
This method also clears any previous data in the Wire.
public void flush()
throws IOException
The method writes the length of the data followed by the actual data to the OutputStream. After the flush, the internal buffer is ready to hold new data.
IOException - If an I/O error occurs.Copyright © 2024. All rights reserved.