MessageEncoder that adds a header and 8-byte schema fingerprint to
each datum encoded as binary.
This class is thread-safe.
| Modifier and Type | Class and Description |
|---|---|
| private static class | BinaryMessageEncoder.V1MessageEncoder<D>
This is a RawDatumEncoder that adds the V1 header to the outgoing buffer. |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final byte[] | |
| private final RawMessageEncoder |
| Access | Constructor and Description |
|---|---|
| public | BinaryMessageEncoder(GenericData
the model, Schema data model for datum instancesthe schema)Schema for datum instancesCreates a new |
| public | BinaryMessageEncoder(GenericData
the model, Schema data model for datum instancesthe schema, boolean Schema for datum instanceswhether to copy buffers before returning encoded results shouldCopy)Creates a new |
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuffer | encode(D
a datum datum)Implements org. |
| public void | encode(D
a datum datum, OutputStream an OutputStream to serialize the datum to stream)Implements org. |
| V1_HEADER | back to summary |
|---|---|
| pack-priv static final byte[] V1_HEADER | |
| writeCodec | back to summary |
|---|---|
| private final RawMessageEncoder<D> writeCodec | |
| BinaryMessageEncoder | back to summary |
|---|---|
| public BinaryMessageEncoder(GenericData model, Schema schema) Creates a new
Buffers returned by
| |
| BinaryMessageEncoder | back to summary |
|---|---|
| public BinaryMessageEncoder(GenericData model, Schema schema, boolean shouldCopy) Creates a new
If
If
| |
| encode | back to summary |
|---|---|
| public ByteBuffer encode(D datum) throws IOException Implements org. Doc from org. Serialize a single datum to a ByteBuffer.
| |
| encode | back to summary |
|---|---|
| public void encode(D datum, OutputStream stream) throws IOException Implements org. Doc from org. Serialize a single datum to an OutputStream.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final byte[] |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | encode(D
a datum datum, OutputStream an OutputStream to serialize the datum to stream)Overrides org. Implements org. |
| private static byte[] |
| headerBytes | back to summary |
|---|---|
| private final byte[] headerBytes | |
| V1MessageEncoder | back to summary |
|---|---|
| pack-priv V1MessageEncoder(GenericData model, Schema schema, boolean shouldCopy) | |
| encode | back to summary |
|---|---|
| public void encode(D datum, OutputStream stream) throws IOException Overrides org. Implements org. Doc from org. Serialize a single datum to an OutputStream.
| |
| getWriteHeader | back to summary |
|---|---|
| private static byte[] getWriteHeader(Schema schema) | |