Class AvroWriter


public class AvroWriter extends IntegrationWriter
Write Records to an Apache Avro file.
  • Constructor Details

    • AvroWriter

      public AvroWriter(File file, DataWriter discardWriter)
      Write Avro data to the specified file.
      Parameters:
      file - the file to write to
      discardWriter - discard sink for records not conforming to the Avro schema
    • AvroWriter

      public AvroWriter(OutputStream outputStream, DataWriter discardWriter)
      Write Avro data to an OutputStream.
      Parameters:
      outputStream - the target stream
      discardWriter - discard sink for records not conforming to the Avro schema
  • Method Details

    • getDiscardedRecordCount

      public long getDiscardedRecordCount()
      Returns the number of discarded Records
      Returns:
      long number of discarded records
    • isWriteUuidAsString

      public boolean isWriteUuidAsString()

      Indicates whether UUID values are written as strings or bytes. If set to false, UUID values will be written as bytes.


      Default value is true.

    • setWriteUuidAsString

      public AvroWriter setWriteUuidAsString(boolean writeUuidAsString)

      Indicates whether UUID values are written as strings or bytes. If set to false, UUID values will be written as bytes.


      Default value is true.

    • getDefaultBigDecimalScale

      public int getDefaultBigDecimalScale()
      Returns the default scale used when writing BigDecimal values (default 5).
    • setDefaultBigDecimalScale

      public AvroWriter setDefaultBigDecimalScale(int defaultBigDecimalScale)
      Sets the default scale used when writing BigDecimal values (default 5).
    • getDefaultBigNumberPrecision

      public int getDefaultBigNumberPrecision()
      Returns the default precision used when writing BigDecimal invalid input: '&' BigInteger values (default 25).
    • setDefaultBigNumberPrecision

      public AvroWriter setDefaultBigNumberPrecision(int defaultBigNumberPrecision)
      Sets the default precision used when writing BigDecimal invalid input: '&' BigInteger values (default 25).
    • isRemoveUnsupportedChars

      public boolean isRemoveUnsupportedChars()
      Returns whether unsupported characters are removed from field names.
    • setRemoveUnsupportedChars

      public AvroWriter setRemoveUnsupportedChars(boolean removeUnsupportedChars)
      Sets whether unsupported characters are removed from field names.
    • open

      public void open() throws DataException
      Description copied from class: DataEndpoint
      Makes this endpoint ready for reading or writing.
      Overrides:
      open in class IntegrationWriter
      Throws:
      DataException
    • close

      public void close() throws DataException
      Description copied from class: DataEndpoint
      Indicates that this endpoint has finished reading or writing.
      Overrides:
      close in class DataEndpoint
      Throws:
      DataException
    • writeImpl

      protected void writeImpl(Record record) throws Throwable
      Description copied from class: DataWriter
      Overridden by subclasses to write the specified record to this DataWriter.

      Contract for subclasses (see also docs/authoring/DataWriter.md):

      Specified by:
      writeImpl in class DataWriter
      Throws:
      Throwable
    • addExceptionProperties

      public DataException addExceptionProperties(DataException exception)
      Description copied from class: Endpoint
      Adds this endpoint's current state to a DataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.
      Overrides:
      addExceptionProperties in class DataWriter