Class 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 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
    • 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
      • 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 Detail

      • ByteBufferToHexFormatJsonEncoder

        public ByteBufferToHexFormatJsonEncoder​(org.apache.avro.Schema sc,
                                                java.io.OutputStream out)
                                         throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • writeBytes

        public void writeBytes​(byte[] bytes,
                               int start,
                               int len)
                        throws java.io.IOException
        Overrides:
        writeBytes in class org.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 class org.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 class org.apache.avro.io.JsonEncoder
        Throws:
        java.io.IOException