Class BinaryFormatter
- java.lang.Object
-
- com.gurock.smartinspect.formatters.Formatter
-
- com.gurock.smartinspect.formatters.BinaryFormatter
-
public class BinaryFormatter extends Formatter
Responsible for formatting and writing a packet in the standard SmartInspect binary format.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 Summary
Constructors Constructor Description BinaryFormatter()Creates and initializes a BinaryFormatter instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompile(Packet packet)Overridden.voidwrite(OutputStream stream)Overridden.
-
-
-
Method Detail
-
compile
public int compile(Packet packet) throws IOException
Overridden. Preprocesses (or compiles) a packet and returns the required size for the compiled result.This method preprocesses the supplied packet and computes the required binary format size. To write this compiled packet, call the write method.
- Specified by:
compilein classFormatter- Parameters:
packet- The packet to compile- Returns:
- The size for the compiled result
- Throws:
IOException- io exception
-
write
public void write(OutputStream stream) throws IOException
Overridden. Writes a previously compiled packet to the supplied stream.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.
- Specified by:
writein classFormatter- Parameters:
stream- The stream to write the packet to- Throws:
IOException- An I/O error occurred while trying to write the compiled packet.
-
-