public abstract class BinaryWriter extends OutputStream
Modifier and Type | Field and Description |
---|---|
protected OutputStream |
out |
Constructor and Description |
---|
BinaryWriter(OutputStream out) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
write(byte[] bytes) |
void |
write(byte[] bytes,
int off,
int len) |
void |
write(int b) |
int |
writeBinary(Binary value)
Write the content of binary to output stream.
|
int |
writeByte(byte integer)
Write a signed byte to the output stream.
|
int |
writeDouble(double value)
Write a double value to stream.
|
abstract int |
writeInt(int integer)
Write a signed int to the output stream.
|
abstract int |
writeLong(long integer)
Write a signed long to the output stream.
|
abstract int |
writeShort(short integer)
Write a signed short to the output stream.
|
int |
writeSigned(int number,
int bytes) |
int |
writeSigned(long number,
int bytes) |
abstract int |
writeUInt16(int number) |
abstract int |
writeUInt24(int number) |
abstract int |
writeUInt32(int number) |
int |
writeUInt8(int number) |
int |
writeUnsigned(int number,
int bytes) |
int |
writeVarint(int varint)
Write a signed number as varint (integer with variable number of bytes,
determined as part of the bytes themselves.
|
int |
writeVarint(long varint)
Write a signed number as varint (integer with variable number of bytes,
determined as part of the bytes themselves.
|
int |
writeZigzag(int number)
Write a long number as zigzag encoded to the stream.
|
int |
writeZigzag(long number)
Write a long number as zigzag encoded to the stream.
|
flush
protected final OutputStream out
public BinaryWriter(OutputStream out)
public void write(int b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] bytes) throws IOException
write
in class OutputStream
IOException
public void write(byte[] bytes, int off, int len) throws IOException
write
in class OutputStream
IOException
public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
public int writeByte(byte integer) throws IOException
integer
- The number to writeBinary.IOException
- if unable to write to stream.public abstract int writeShort(short integer) throws IOException
integer
- The number to writeBinary.IOException
- if unable to write to stream.public abstract int writeInt(int integer) throws IOException
integer
- The number to writeBinary.IOException
- if unable to write to stream.public abstract int writeLong(long integer) throws IOException
integer
- The number to writeBinary.IOException
- if unable to write to stream.public int writeDouble(double value) throws IOException
value
- The double value to writeBinary.IOException
- if unable to write to stream.public int writeBinary(Binary value) throws IOException
value
- Binary to writeBinary.IOException
- if unable to write to stream.public int writeUInt8(int number) throws IOException
number
- Unsigned byte to writeBinary.IOException
- if unable to write to stream.public abstract int writeUInt16(int number) throws IOException
number
- Unsigned short to writeBinary.IOException
- if unable to write to stream.public abstract int writeUInt24(int number) throws IOException
number
- Unsigned short to writeBinary.IOException
- if unable to write to stream.public abstract int writeUInt32(int number) throws IOException
number
- Unsigned short to writeBinary.IOException
- if unable to write to stream.public int writeUnsigned(int number, int bytes) throws IOException
number
- Unsigned integer to writeBinary.bytes
- Number of bytes to writeBinary.IOException
- if unable to write to stream.public int writeSigned(int number, int bytes) throws IOException
number
- Signed integer to writeBinary.bytes
- Number of bytes to writeBinary.IOException
- if unable to write to stream.public int writeSigned(long number, int bytes) throws IOException
number
- Signed integer to writeBinary.bytes
- Number of bytes to writeBinary.IOException
- if unable to write to stream.public int writeZigzag(int number) throws IOException
number
- The number to writeBinary.IOException
- if unable to write to stream.public int writeZigzag(long number) throws IOException
number
- The number to writeBinary.IOException
- if unable to write to stream.public int writeVarint(int varint) throws IOException
varint
- The number to writeBinary.IOException
- if unable to write to stream.public int writeVarint(long varint) throws IOException
varint
- The number to writeBinary.IOException
- if unable to write to stream.Copyright © 2017. All rights reserved.