Class AvroSerializer<K>

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AvroSerializer​(org.apache.avro.io.DatumWriter<K> genericDatumWriter, org.apache.avro.io.DatumWriter<K> specificDatumWriter)  
      protected AvroSerializer​(org.apache.avro.io.DatumWriter<K> genericDatumWriter, org.apache.avro.io.DatumWriter<K> specificDatumWriter, boolean buffered)  
        AvroSerializer​(org.apache.avro.Schema schema)  
        AvroSerializer​(org.apache.avro.Schema schema, boolean buffered)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] serialize​(K object)  
      byte[] serializeObjects​(java.lang.Iterable<K> objects)  
      byte[] serializeObjects​(java.lang.Iterable<K> objects, java.nio.ByteBuffer prefix)
      Serialize a list of objects and put the prefix before the serialized objects.
      protected byte[] serializeObjects​(java.lang.Iterable<K> objects, org.apache.avro.io.BinaryEncoder reusedEncoder, java.io.ByteArrayOutputStream outputStream)  
      protected void write​(K object, org.apache.avro.io.Encoder encoder)  
      • Methods inherited from class java.lang.Object

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

      • AvroSerializer

        public AvroSerializer​(org.apache.avro.Schema schema)
      • AvroSerializer

        public AvroSerializer​(org.apache.avro.Schema schema,
                              boolean buffered)
      • AvroSerializer

        protected AvroSerializer​(org.apache.avro.io.DatumWriter<K> genericDatumWriter,
                                 org.apache.avro.io.DatumWriter<K> specificDatumWriter)
      • AvroSerializer

        protected AvroSerializer​(org.apache.avro.io.DatumWriter<K> genericDatumWriter,
                                 org.apache.avro.io.DatumWriter<K> specificDatumWriter,
                                 boolean buffered)
    • Method Detail

      • serializeObjects

        public byte[] serializeObjects​(java.lang.Iterable<K> objects,
                                       java.nio.ByteBuffer prefix)
                                throws VeniceException
        Serialize a list of objects and put the prefix before the serialized objects. This function could avoid unnecessary byte array copy when you want to serialize two different kinds of objects together. Essentially, the {@param prefix} will be the serialized byte array of the first kind of objects.
        Specified by:
        serializeObjects in interface RecordSerializer<K>
        Parameters:
        objects -
        prefix -
        Returns:
        Throws:
        VeniceException
      • serializeObjects

        protected byte[] serializeObjects​(java.lang.Iterable<K> objects,
                                          org.apache.avro.io.BinaryEncoder reusedEncoder,
                                          java.io.ByteArrayOutputStream outputStream)
                                   throws VeniceException
        Throws:
        VeniceException
      • write

        protected void write​(K object,
                             org.apache.avro.io.Encoder encoder)
                      throws java.io.IOException
        Throws:
        java.io.IOException