public class AvroWriter extends IntegrationWriter
Records to an Apache Avro file.DataEndpoint.StatelastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEYBUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZEid, log, name, TIMESTAMP_FORMAT| Constructor and Description |
|---|
AvroWriter(File file,
DataWriter discardWriter)
Write Avro data to the specified file.
|
AvroWriter(OutputStream outputStream,
DataWriter discardWriter)
Write Avro data to an
OutputStream. |
| Modifier and Type | Method and Description |
|---|---|
DataException |
addExceptionProperties(DataException exception)
Adds this endpoint's current state to a
DataException. |
void |
close()
Indicates that this endpoint has finished reading or writing.
|
int |
getDefaultBigDecimalScale()
Returns the default scale used when writing BigDecimal values (default 5).
|
int |
getDefaultBigNumberPrecision()
Returns the default precision used when writing BigDecimal & BigInteger values (default 25).
|
long |
getDiscardedRecordCount()
Returns the number of discarded
Records |
boolean |
isRemoveUnsupportedChars()
Returns whether unsupported characters are removed from field names.
|
boolean |
isWriteUuidAsString()
Indicates whether UUID values are written as strings or bytes.
|
void |
open()
Makes this endpoint ready for reading or writing.
|
AvroWriter |
setDefaultBigDecimalScale(int defaultBigDecimalScale)
Sets the default scale used when writing BigDecimal values (default 5).
|
AvroWriter |
setDefaultBigNumberPrecision(int defaultBigNumberPrecision)
Sets the default precision used when writing BigDecimal & BigInteger values (default 25).
|
AvroWriter |
setRemoveUnsupportedChars(boolean removeUnsupportedChars)
Sets whether unsupported characters are removed from field names.
|
AvroWriter |
setWriteUuidAsString(boolean writeUuidAsString)
Indicates whether UUID values are written as strings or bytes.
|
protected void |
writeImpl(Record record)
Overridden by subclasses to write the specified record to this
DataWriter. |
available, getNestedEndpoint, getNestedWriter, getRootEndpoint, getRootWriter, getWriter, writedecrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toStringaddElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescriptionpublic AvroWriter(File file, DataWriter discardWriter)
file - the file to write todiscardWriter - discard sink for records not conforming to the Avro schemapublic AvroWriter(OutputStream outputStream, DataWriter discardWriter)
OutputStream.outputStream - the target streamdiscardWriter - discard sink for records not conforming to the Avro schemapublic long getDiscardedRecordCount()
Recordspublic 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.
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.
public int getDefaultBigDecimalScale()
public AvroWriter setDefaultBigDecimalScale(int defaultBigDecimalScale)
public int getDefaultBigNumberPrecision()
public AvroWriter setDefaultBigNumberPrecision(int defaultBigNumberPrecision)
public boolean isRemoveUnsupportedChars()
public AvroWriter setRemoveUnsupportedChars(boolean removeUnsupportedChars)
public void open()
throws DataException
DataEndpointopen in class IntegrationWriterDataExceptionpublic void close()
throws DataException
DataEndpointclose in class DataEndpointDataExceptionprotected void writeImpl(Record record) throws Throwable
DataWriterDataWriter.writeImpl in class DataWriterThrowablepublic DataException addExceptionProperties(DataException exception)
EndpointDataException. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.addExceptionProperties in class DataWriterCopyright (c) 2006-2025 North Concepts Inc. All Rights Reserved.