Class JsonLinesWriter
java.lang.Object
Writes records in JSON Lines format: each record as a JSON object on its own line.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.northconcepts.datapipeline.core.DataEndpoint
DataEndpoint.State -
Field Summary
Fields inherited from class com.northconcepts.datapipeline.core.AbstractWriter
currentRecordFields inherited from class com.northconcepts.datapipeline.core.DataEndpoint
lastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEYFields inherited from class com.northconcepts.datapipeline.core.Endpoint
BUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZEFields inherited from class com.northconcepts.datapipeline.core.DataObject
id, log, name, TIMESTAMP_FORMAT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassembleLine(Record record, StringBuilder lineBuffer) Appends the record's output line, without a line terminator, to the empty buffer; also called for the header row (seeAbstractWriter.isHeaderRow()).setAutoCloseWriter(boolean autoCloseWriter) Indicates if the underlying java.io.BufferedWriter should be closed when this stream closes (defaults to true).setDescription(String description) Sets the optional text shown for this endpoint inEndpoint.toString()and exception properties.setFieldNamesInFirstRow(boolean fieldNamesInFirstRow) Indicates if a header row of field names is written before the first record (default is true); must be called beforeAbstractWriter.open().setFlushOnWrite(boolean flushOnWrite) Indicates if the underlying java.io.BufferedWriter should be flushed after each record is written (defaults to false).Methods inherited from class com.northconcepts.datapipeline.core.LinedTextWriter
addExceptionProperties, getNewLine, setNewLine, writeRecordMethods inherited from class com.northconcepts.datapipeline.core.TextWriter
close, getFile, getWriter, isAppend, isAutoCloseWriter, isFieldNamesInFirstRow, isFlushOnWrite, writeMethods inherited from class com.northconcepts.datapipeline.core.AbstractWriter
createHeaderRecord, isHeaderRow, open, writeImplMethods inherited from class com.northconcepts.datapipeline.core.DataWriter
available, getNestedEndpoint, getNestedWriter, getRootEndpoint, getRootWriter, getWriterMethods inherited from class com.northconcepts.datapipeline.core.DataEndpoint
decrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toStringMethods inherited from class com.northconcepts.datapipeline.core.Endpoint
addElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime
-
Constructor Details
-
JsonLinesWriter
-
JsonLinesWriter
-
-
Method Details
-
setAutoCloseWriter
Description copied from class:TextWriterIndicates if the underlying java.io.BufferedWriter should be closed when this stream closes (defaults to true).- Overrides:
setAutoCloseWriterin classTextWriter
-
setFlushOnWrite
Description copied from class:TextWriterIndicates if the underlying java.io.BufferedWriter should be flushed after each record is written (defaults to false).- Overrides:
setFlushOnWritein classTextWriter
-
setFieldNamesInFirstRow
Description copied from class:AbstractWriterIndicates if a header row of field names is written before the first record (default is true); must be called beforeAbstractWriter.open().- Overrides:
setFieldNamesInFirstRowin classAbstractWriter
-
setDescription
Description copied from class:EndpointSets the optional text shown for this endpoint inEndpoint.toString()and exception properties.- Overrides:
setDescriptionin classEndpoint
-
assembleLine
Description copied from class:LinedTextWriterAppends the record's output line, without a line terminator, to the empty buffer; also called for the header row (seeAbstractWriter.isHeaderRow()).- Specified by:
assembleLinein classLinedTextWriter- Throws:
Throwable
-