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:
java.io.Flushable
,org.apache.avro.io.parsing.Parser.ActionHandler
public class ByteBufferToHexFormatJsonEncoder extends org.apache.avro.io.JsonEncoder
This class overridesJsonEncoder.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.
-
-
Constructor Summary
Constructors Constructor Description ByteBufferToHexFormatJsonEncoder(org.apache.avro.Schema sc, java.io.OutputStream out)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
writeBytes(byte[] bytes, int start, int len)
void
writeFixed(byte[] bytes, int start, int len)
void
writeString(java.lang.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
-
-
-
-
Method Detail
-
writeBytes
public void writeBytes(byte[] bytes, int start, int len) throws java.io.IOException
- Overrides:
writeBytes
in classorg.apache.avro.io.JsonEncoder
- Throws:
java.io.IOException
-
writeFixed
public void writeFixed(byte[] bytes, int start, int len) throws java.io.IOException
- Overrides:
writeFixed
in classorg.apache.avro.io.JsonEncoder
- Throws:
java.io.IOException
-
writeString
public void writeString(java.lang.String str) throws java.io.IOException
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:
java.io.IOException
-
-