Package net.morimekta.util.io
Class LittleEndianBinaryWriter
- java.lang.Object
-
- java.io.OutputStream
-
- net.morimekta.util.io.BinaryWriter
-
- net.morimekta.util.io.LittleEndianBinaryWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public class LittleEndianBinaryWriter extends BinaryWriter
IO-Optimized binary writer using little-endian integer encoding.
-
-
Field Summary
-
Fields inherited from class net.morimekta.util.io.BinaryWriter
out
-
-
Constructor Summary
Constructors Constructor Description LittleEndianBinaryWriter(java.io.OutputStream out)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
writeInt(int integer)
Write a signed int to the output stream.int
writeLong(long integer)
Write a signed long to the output stream.int
writeShort(short integer)
Write a signed short to the output stream.int
writeUInt16(int number)
int
writeUInt24(int number)
int
writeUInt32(int number)
-
Methods inherited from class net.morimekta.util.io.BinaryWriter
close, write, write, write, writeBinary, writeByte, writeDouble, writeSigned, writeSigned, writeUInt8, writeUnsigned, writeVarint, writeVarint, writeZigzag, writeZigzag
-
-
-
-
Method Detail
-
writeShort
public int writeShort(short integer) throws java.io.IOException
Description copied from class:BinaryWriter
Write a signed short to the output stream.- Specified by:
writeShort
in classBinaryWriter
- Parameters:
integer
- The number to writeBinary.- Returns:
- Number of bytes written.
- Throws:
java.io.IOException
- if unable to write to stream.
-
writeInt
public int writeInt(int integer) throws java.io.IOException
Description copied from class:BinaryWriter
Write a signed int to the output stream.- Specified by:
writeInt
in classBinaryWriter
- Parameters:
integer
- The number to writeBinary.- Returns:
- Number of bytes written.
- Throws:
java.io.IOException
- if unable to write to stream.
-
writeLong
public int writeLong(long integer) throws java.io.IOException
Description copied from class:BinaryWriter
Write a signed long to the output stream.- Specified by:
writeLong
in classBinaryWriter
- Parameters:
integer
- The number to writeBinary.- Returns:
- Number of bytes written.
- Throws:
java.io.IOException
- if unable to write to stream.
-
writeUInt16
public int writeUInt16(int number) throws java.io.IOException
- Specified by:
writeUInt16
in classBinaryWriter
- Parameters:
number
- Unsigned short to writeBinary.- Returns:
- Number of bytes written.
- Throws:
java.io.IOException
- if unable to write to stream.
-
writeUInt24
public int writeUInt24(int number) throws java.io.IOException
- Specified by:
writeUInt24
in classBinaryWriter
- Parameters:
number
- Unsigned short to writeBinary.- Returns:
- Number of bytes written.
- Throws:
java.io.IOException
- if unable to write to stream.
-
writeUInt32
public int writeUInt32(int number) throws java.io.IOException
- Specified by:
writeUInt32
in classBinaryWriter
- Parameters:
number
- Unsigned short to writeBinary.- Returns:
- Number of bytes written.
- Throws:
java.io.IOException
- if unable to write to stream.
-
-