- java.lang.Object
-
- java.io.OutputStream
-
- net.morimekta.io.BinaryOutputStream
-
- net.morimekta.io.LittleEndianBinaryOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class LittleEndianBinaryOutputStream extends BinaryOutputStream
IO-Optimized binary writer using little-endian integer encoding.
-
-
Field Summary
-
Fields inherited from class net.morimekta.io.BinaryOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description LittleEndianBinaryOutputStream(OutputStream out)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
writeBase128(int i)
Write a signed number as varint (integer with variable number of bytes, determined as part of the bytes themselves.int
writeBase128(long i)
Write a signed number as base 128 (integer with variable number of bytes, determined as part of the bytes themselves.void
writeInt(int integer)
Write a signed int to the output stream.void
writeLong(long integer)
Write a signed long to the output stream.void
writeShort(short integer)
Write a signed short to the output stream.void
writeUInt16(int number)
void
writeUInt24(int number)
void
writeUInt32(int number)
void
writeULong32(long number)
void
writeULong40(long number)
void
writeULong48(long number)
void
writeULong56(long number)
void
writeULong64(long number)
-
Methods inherited from class net.morimekta.io.BinaryOutputStream
close, flush, write, write, write, writeByte, writeDouble, writeFloat, writeSigned, writeSigned, writeUInt8, writeUnsigned, writeUnsignedLong, writeVarint, writeVarint, writeZigzag, writeZigzag
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
LittleEndianBinaryOutputStream
public LittleEndianBinaryOutputStream(OutputStream out)
-
-
Method Detail
-
writeShort
public void writeShort(short integer) throws IOException
Description copied from class:BinaryOutputStream
Write a signed short to the output stream.- Specified by:
writeShort
in classBinaryOutputStream
- Parameters:
integer
- The number to write.- Throws:
IOException
- if unable to write to stream.
-
writeInt
public void writeInt(int integer) throws IOException
Description copied from class:BinaryOutputStream
Write a signed int to the output stream.- Specified by:
writeInt
in classBinaryOutputStream
- Parameters:
integer
- The number to write.- Throws:
IOException
- if unable to write to stream.
-
writeLong
public void writeLong(long integer) throws IOException
Description copied from class:BinaryOutputStream
Write a signed long to the output stream.- Specified by:
writeLong
in classBinaryOutputStream
- Parameters:
integer
- The number to write.- Throws:
IOException
- if unable to write to stream.
-
writeUInt16
public void writeUInt16(int number) throws IOException
- Specified by:
writeUInt16
in classBinaryOutputStream
- Parameters:
number
- Unsigned :16 to write.- Throws:
IOException
- if unable to write to stream.
-
writeUInt24
public void writeUInt24(int number) throws IOException
- Specified by:
writeUInt24
in classBinaryOutputStream
- Parameters:
number
- Unsigned :24 to write.- Throws:
IOException
- if unable to write to stream.
-
writeUInt32
public void writeUInt32(int number) throws IOException
- Specified by:
writeUInt32
in classBinaryOutputStream
- Parameters:
number
- Unsigned :32 to write.- Throws:
IOException
- if unable to write to stream.
-
writeULong32
public void writeULong32(long number) throws IOException
- Specified by:
writeULong32
in classBinaryOutputStream
- Parameters:
number
- Unsigned :32 to write, but a long number.- Throws:
IOException
- if unable to write to stream.
-
writeULong40
public void writeULong40(long number) throws IOException
- Specified by:
writeULong40
in classBinaryOutputStream
- Parameters:
number
- Unsigned :40 to write.- Throws:
IOException
- if unable to write to stream.
-
writeULong48
public void writeULong48(long number) throws IOException
- Specified by:
writeULong48
in classBinaryOutputStream
- Parameters:
number
- Unsigned :48 to write.- Throws:
IOException
- if unable to write to stream.
-
writeULong56
public void writeULong56(long number) throws IOException
- Specified by:
writeULong56
in classBinaryOutputStream
- Parameters:
number
- Unsigned :56 to write.- Throws:
IOException
- if unable to write to stream.
-
writeULong64
public void writeULong64(long number) throws IOException
- Specified by:
writeULong64
in classBinaryOutputStream
- Parameters:
number
- Unsigned :64 to write.- Throws:
IOException
- if unable to write to stream.
-
writeBase128
public int writeBase128(int i) throws IOException
Description copied from class:BinaryOutputStream
Write a signed number as varint (integer with variable number of bytes, determined as part of the bytes themselves.- Specified by:
writeBase128
in classBinaryOutputStream
- Parameters:
i
- The number to write.- Returns:
- The number of bytes written.
- Throws:
IOException
- if unable to write to stream.
-
writeBase128
public int writeBase128(long i) throws IOException
Description copied from class:BinaryOutputStream
Write a signed number as base 128 (integer with variable number of bytes, determined as part of the bytes themselves.- Specified by:
writeBase128
in classBinaryOutputStream
- Parameters:
i
- The number to write.- Returns:
- The number of bytes written.
- Throws:
IOException
- if unable to write to stream.
-
-