public class ProxyWriter extends DataWriter
DataWriter
,
possibly transforming them along the way. The only method that a subclass
should implement is interceptRecord(Record)
.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 |
---|
ProxyWriter(DataWriter nestedDataWriter) |
Modifier and Type | Method and Description |
---|---|
DataException |
addExceptionProperties(DataException exception)
Adds this endpoint's current state to a
DataException . |
int |
available()
Returns the number of records that can probably be written without blocking.
|
void |
close()
Indicates that this endpoint has finished reading or writing.
|
DataWriter |
getNestedWriter()
Returns the
DataWriter held inside this one or null if there isn't one. |
protected Record |
interceptRecord(Record record) |
static ProxyWriter |
map(DataWriter writer,
BiFunction<ProxyWriter,Record,Record> mapper) |
static ProxyWriter |
map(DataWriter Writer,
Function<Record,Record> mapper) |
void |
open()
Makes this endpoint ready for reading or writing.
|
protected void |
setNestedDataWriter(DataWriter nestedDataWriter)
Make sure to close old target and open the new one or call
setNestedDataWriter(DataWriter, boolean) with true . |
protected void |
setNestedDataWriter(DataWriter nestedDataWriter,
boolean manageLifecycle) |
protected void |
writeImpl(Record record)
Overridden by subclasses to write the specified record to this
DataWriter . |
getNestedEndpoint, getRootEndpoint, getRootWriter, write
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 ProxyWriter(DataWriter nestedDataWriter)
public static ProxyWriter map(DataWriter Writer, Function<Record,Record> mapper) throws Throwable
Throwable
public static ProxyWriter map(DataWriter writer, BiFunction<ProxyWriter,Record,Record> mapper) throws Throwable
Throwable
public DataWriter getNestedWriter()
DataWriter
DataWriter
held inside this one or null
if there isn't one.getNestedWriter
in class DataWriter
protected void setNestedDataWriter(DataWriter nestedDataWriter)
setNestedDataWriter(DataWriter, boolean)
with true
.protected void setNestedDataWriter(DataWriter nestedDataWriter, boolean manageLifecycle) throws DataException
DataException
public int available() throws DataException
DataWriter
available
in class DataWriter
DataException
public void open() throws DataException
DataEndpoint
open
in class DataEndpoint
DataException
public void close() throws DataException
DataEndpoint
close
in class DataEndpoint
DataException
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 DataWriter
Copyright (c) 2006-2024 North Concepts Inc. All Rights Reserved.