public class BinaryFormatter extends Formatter
This class formats and writes a packet in the standard binary format which can be read by the SmartInspect Console. The compile method preprocesses a packet and computes the required size of the packet. The write method writes the preprocessed packet to the supplied stream.
This class is not guaranteed to be threadsafe.
| Constructor and Description |
|---|
BinaryFormatter()
Creates and initializes a BinaryFormatter instance.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compile(Packet packet)
Overridden.
|
void |
write(OutputStream stream)
Overridden.
|
public BinaryFormatter()
public int compile(Packet packet) throws IOException
This method preprocesses the supplied packet and computes the required binary format size. To write this compiled packet, call the write method.
compile in class Formatterpacket - The packet to compileIOException - io exceptionpublic void write(OutputStream stream) throws IOException
This method writes the previously compiled packet (see Compile) to the supplied stream object. If the return value of the compile method was 0, nothing is written.
write in class Formatterstream - The stream to write the packet toIOException - An I/O error occurred while trying
to write the compiled packet.Copyright © 2023. All rights reserved.