Package org.apache.avro.io
Class ByteBufferToHexFormatJsonEncoder
java.lang.Object
org.apache.avro.io.Encoder
org.apache.avro.io.ParsingEncoder
org.apache.avro.io.JsonEncoder
org.apache.avro.io.ByteBufferToHexFormatJsonEncoder
- All Implemented Interfaces:
Flushable
,org.apache.avro.io.parsing.Parser.ActionHandler
public class ByteBufferToHexFormatJsonEncoder
extends org.apache.avro.io.JsonEncoder
This class overrides
JsonEncoder.writeBytes(byte[], int, int)
, in order to convert
all bytes schema data to hexadecimal strings in the output stream, since hexadecimal strings
are more readable.
This should be used in tooling only.-
Field Summary
Fields inherited from class org.apache.avro.io.JsonEncoder
isEmpty
Fields inherited from class org.apache.avro.io.ParsingEncoder
pos
-
Constructor Summary
ConstructorDescriptionByteBufferToHexFormatJsonEncoder
(org.apache.avro.Schema sc, OutputStream out) -
Method Summary
Modifier and TypeMethodDescriptionvoid
writeBytes
(byte[] bytes, int start, int len) void
writeFixed
(byte[] bytes, int start, int len) void
writeString
(String str) Detect whether there is any non-ASCII character; if so, transfer the entire string into hexadecimal string.Methods inherited from class org.apache.avro.io.JsonEncoder
configure, doAction, flush, isIncludeNamespace, setIncludeNamespace, startItem, writeArrayEnd, writeArrayStart, writeBoolean, writeBytes, writeDouble, writeEnum, writeFloat, writeIndex, writeInt, writeLong, writeMapEnd, writeMapStart, writeNull, writeString
Methods inherited from class org.apache.avro.io.ParsingEncoder
depth, pop, push, setItemCount
Methods inherited from class org.apache.avro.io.Encoder
writeBytes, writeFixed, writeFixed, writeString
-
Constructor Details
-
ByteBufferToHexFormatJsonEncoder
public ByteBufferToHexFormatJsonEncoder(org.apache.avro.Schema sc, OutputStream out) throws IOException - Throws:
IOException
-
-
Method Details
-
writeBytes
- Overrides:
writeBytes
in classorg.apache.avro.io.JsonEncoder
- Throws:
IOException
-
writeFixed
- Overrides:
writeFixed
in classorg.apache.avro.io.JsonEncoder
- Throws:
IOException
-
writeString
Detect whether there is any non-ASCII character; if so, transfer the entire string into hexadecimal string.- Overrides:
writeString
in classorg.apache.avro.io.JsonEncoder
- Throws:
IOException
-