public class JsonRecordWriter extends TextStreamWriter
DataEndpoint.State
lastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEY
BUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZE
id, log, name, TIMESTAMP_FORMAT
Constructor and Description |
---|
JsonRecordWriter(File file) |
JsonRecordWriter(Writer writer) |
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.
|
String |
getRootFieldName() |
boolean |
isPretty()
Indicates if line breaks and indentations should be added to output (default false).
|
void |
open()
Makes this endpoint ready for reading or writing.
|
JsonRecordWriter |
setPretty(boolean pretty)
Indicates if line breaks and indentations should be added to output (default false).
Example output (pretty = true): [ { "country":"Philippines" ,"capital":"Manila" } ] Example output (pretty = false): [{"country":"Philippines","capital":"Manila"}] |
JsonRecordWriter |
setRootFieldName(String rootFieldName) |
protected void |
writeImpl(Record record)
Overridden by subclasses to write the specified record to this
DataWriter . |
getFile, getWriter, isAutoCloseWriter, isFlushOnWrite, setAutoCloseWriter, setFlushOnWrite, write
available, getNestedEndpoint, getNestedWriter, getRootEndpoint, getRootWriter
decrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toString
addElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescription
public JsonRecordWriter(File file)
public JsonRecordWriter(Writer writer)
public boolean isPretty()
public JsonRecordWriter setPretty(boolean pretty)
public String getRootFieldName()
public JsonRecordWriter setRootFieldName(String rootFieldName)
public void open()
DataEndpoint
open
in class DataEndpoint
public void close()
DataEndpoint
close
in class TextStreamWriter
protected void writeImpl(Record record) throws Throwable
DataWriter
DataWriter
.writeImpl
in class DataWriter
Throwable
public DataException addExceptionProperties(DataException exception)
Endpoint
DataException
. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.addExceptionProperties
in class TextStreamWriter
Copyright (c) 2006-2024 North Concepts Inc. All Rights Reserved.