Encoder for Avro's binary encoding that does not buffer output.
This encoder does not buffer writes, and as a result is slower than
BufferedBinaryEncoder. However, it is lighter-weight and useful when
the buffering in BufferedBinaryEncoder is not desired and/or the Encoder is
very short lived.
To construct, use
EncoderFactory#directBinaryEncoder(OutputStream, BinaryEncoder)
DirectBinaryEncoder is not thread-safe
BinaryEncoder, EncoderFactory, Encoder, Decoder
| Modifier and Type | Field and Description |
|---|---|
| private final byte[] | |
| private OutputStream |
| Access | Constructor and Description |
|---|---|
| pack-priv | DirectBinaryEncoder(OutputStream out)
Create a writer that sends its output to the underlying stream
|
| Modifier and Type | Method and Description |
|---|---|
| public int | bytesBuffered()
Implements abstract org. |
| pack-priv DirectBinaryEncoder | |
| public void | flush()
Implements java. |
| public void | writeBoolean(boolean b)
Implements abstract org. |
| public void | |
| public void | writeFixed(byte[]
The contents to write bytes, int The position within bytes where the contents start. start, int The number of bytes to write. len)Implements abstract org. |
| public void | |
| public void | |
| public void | |
| protected void | writeZero()
Implements abstract org. |
| buf | back to summary |
|---|---|
| private final byte[] buf | |
| out | back to summary |
|---|---|
| private OutputStream out | |
| DirectBinaryEncoder | back to summary |
|---|---|
| pack-priv DirectBinaryEncoder(OutputStream out) Create a writer that sends its output to the underlying stream
| |
| bytesBuffered | back to summary |
|---|---|
| public int bytesBuffered() Implements abstract org. Doc from org. Returns the number of bytes currently buffered by this encoder. If this Encoder does not buffer, this will always return zero.
Call
| |
| configure | back to summary |
|---|---|
| pack-priv DirectBinaryEncoder configure(OutputStream out) | |
| flush | back to summary |
|---|---|
| public void flush() throws IOException Implements java. Doc from java. Flushes this stream by writing any buffered output to the underlying stream.
| |
| writeBoolean | back to summary |
|---|---|
| public void writeBoolean(boolean b) throws IOException Implements abstract org. Doc from org. Write a boolean value.
| |
| writeDouble | back to summary |
|---|---|
| public void writeDouble(double d) throws IOException Implements abstract org. Doc from org. Write a double.
| |
| writeFixed | back to summary |
|---|---|
| public void writeFixed(byte[] bytes, int start, int len) throws IOException Implements abstract org. Doc from org. Writes a fixed size binary object.
| |
| writeFloat | back to summary |
|---|---|
| public void writeFloat(float f) throws IOException Implements abstract org. Doc from org. Write a float.
| |
| writeInt | back to summary |
|---|---|
| public void writeInt(int n) throws IOException Implements abstract org. Doc from org. Writes a 32-bit integer.
| |
| writeLong | back to summary |
|---|---|
| public void writeLong(long n) throws IOException Implements abstract org. Doc from org. Write a 64-bit integer.
| |
| writeZero | back to summary |
|---|---|
| protected void writeZero() throws IOException Implements abstract org. Doc from org. Write a zero byte to the underlying output.
| |