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

    Constructors
    Constructor
    Description
    ByteBufferToHexFormatJsonEncoder(org.apache.avro.Schema sc, OutputStream out)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    writeBytes(byte[] bytes, int start, int len)
     
    void
    writeFixed(byte[] bytes, int start, int len)
     
    void
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • writeBytes

      public void writeBytes(byte[] bytes, int start, int len) throws IOException
      Overrides:
      writeBytes in class org.apache.avro.io.JsonEncoder
      Throws:
      IOException
    • writeFixed

      public void writeFixed(byte[] bytes, int start, int len) throws IOException
      Overrides:
      writeFixed in class org.apache.avro.io.JsonEncoder
      Throws:
      IOException
    • writeString

      public void writeString(String str) throws IOException
      Detect whether there is any non-ASCII character; if so, transfer the entire string into hexadecimal string.
      Overrides:
      writeString in class org.apache.avro.io.JsonEncoder
      Throws:
      IOException