Class BinaryOutput
java.lang.Object
se.l4.commons.serialization.format.BinaryOutput
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,StreamingOutput
public class BinaryOutput extends Object implements StreamingOutput
Output for custom binary format.
- Author:
- Andreas Holstenson
-
Field Summary
Fields Modifier and Type Field Description static intTAG_BOOLEANstatic intTAG_BYTE_ARRAYstatic intTAG_DOUBLEstatic intTAG_FLOATstatic intTAG_INTstatic intTAG_KEYstatic intTAG_LIST_ENDstatic intTAG_LIST_STARTstatic intTAG_LONGstatic intTAG_NEGATIVE_INTstatic intTAG_NEGATIVE_LONGstatic intTAG_NULLstatic intTAG_OBJECT_ENDstatic intTAG_OBJECT_STARTstatic intTAG_POSITIVE_INTstatic intTAG_POSITIVE_LONGstatic intTAG_STRING -
Constructor Summary
Constructors Constructor Description BinaryOutput(OutputStream out) -
Method Summary
Modifier and Type Method Description voidclose()voidflush()voidwrite(String name, boolean bool)Write a boolean.voidwrite(String name, byte[] data)Write a byte array to the output.voidwrite(String name, double number)Write a double.voidwrite(String name, float number)Write a float.voidwrite(String name, int number)Write an integer.voidwrite(String name, long number)Write a long.voidwrite(String name, String value)Write a string.voidwriteListEnd(String name)Write the end of a list.voidwriteListStart(String name)Write the start of a list.voidwriteNull(String name)Write a null value.voidwriteObjectEnd(String name)Write the end of an object.voidwriteObjectStart(String name)Write the start of an object.
-
Field Details
-
TAG_KEY
public static final int TAG_KEY- See Also:
- Constant Field Values
-
TAG_OBJECT_START
public static final int TAG_OBJECT_START- See Also:
- Constant Field Values
-
TAG_OBJECT_END
public static final int TAG_OBJECT_END- See Also:
- Constant Field Values
-
TAG_LIST_START
public static final int TAG_LIST_START- See Also:
- Constant Field Values
-
TAG_LIST_END
public static final int TAG_LIST_END- See Also:
- Constant Field Values
-
TAG_STRING
public static final int TAG_STRING- See Also:
- Constant Field Values
-
TAG_INT
public static final int TAG_INT- See Also:
- Constant Field Values
-
TAG_LONG
public static final int TAG_LONG- See Also:
- Constant Field Values
-
TAG_NULL
public static final int TAG_NULL- See Also:
- Constant Field Values
-
TAG_FLOAT
public static final int TAG_FLOAT- See Also:
- Constant Field Values
-
TAG_DOUBLE
public static final int TAG_DOUBLE- See Also:
- Constant Field Values
-
TAG_BOOLEAN
public static final int TAG_BOOLEAN- See Also:
- Constant Field Values
-
TAG_BYTE_ARRAY
public static final int TAG_BYTE_ARRAY- See Also:
- Constant Field Values
-
TAG_POSITIVE_INT
public static final int TAG_POSITIVE_INT- See Also:
- Constant Field Values
-
TAG_POSITIVE_LONG
public static final int TAG_POSITIVE_LONG- See Also:
- Constant Field Values
-
TAG_NEGATIVE_INT
public static final int TAG_NEGATIVE_INT- See Also:
- Constant Field Values
-
TAG_NEGATIVE_LONG
public static final int TAG_NEGATIVE_LONG- See Also:
- Constant Field Values
-
-
Constructor Details
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
writeObjectStart
Description copied from interface:StreamingOutputWrite the start of an object.- Specified by:
writeObjectStartin interfaceStreamingOutput- Throws:
IOException
-
writeObjectEnd
Description copied from interface:StreamingOutputWrite the end of an object.- Specified by:
writeObjectEndin interfaceStreamingOutput- Throws:
IOException
-
writeListStart
Description copied from interface:StreamingOutputWrite the start of a list.- Specified by:
writeListStartin interfaceStreamingOutput- Throws:
IOException
-
writeListEnd
Description copied from interface:StreamingOutputWrite the end of a list.- Specified by:
writeListEndin interfaceStreamingOutput- Throws:
IOException
-
write
Description copied from interface:StreamingOutputWrite a string.- Specified by:
writein interfaceStreamingOutput- Throws:
IOException
-
write
Description copied from interface:StreamingOutputWrite an integer.- Specified by:
writein interfaceStreamingOutput- Throws:
IOException
-
write
Description copied from interface:StreamingOutputWrite a long.- Specified by:
writein interfaceStreamingOutput- Throws:
IOException
-
write
Description copied from interface:StreamingOutputWrite a float.- Specified by:
writein interfaceStreamingOutput- Throws:
IOException
-
write
Description copied from interface:StreamingOutputWrite a double.- Specified by:
writein interfaceStreamingOutput- Throws:
IOException
-
write
Description copied from interface:StreamingOutputWrite a boolean.- Specified by:
writein interfaceStreamingOutput- Throws:
IOException
-
write
Description copied from interface:StreamingOutputWrite a byte array to the output.- Specified by:
writein interfaceStreamingOutput- Throws:
IOException
-
writeNull
Description copied from interface:StreamingOutputWrite a null value.- Specified by:
writeNullin interfaceStreamingOutput- Throws:
IOException
-
flush
- Specified by:
flushin interfaceFlushable- Throws:
IOException
-