public class FileWriter extends DataWriter
FileReader
.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 |
---|
FileWriter(DataOutput out) |
FileWriter(File file) |
FileWriter(File file,
boolean append) |
FileWriter(File file,
boolean append,
boolean compressed) |
FileWriter(OutputStream outputStream,
boolean compressed) |
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.
|
boolean |
isAppend()
Indicates if writing should start at the end of the file (if it exists).
|
boolean |
isAutoCloseWriter()
Indicates if the underlying output stream should be closed when this stream closes (defaults to true).
|
boolean |
isCompressed()
Indicates if the data should be compressed as it is being written (default false).
|
boolean |
isFlushOnWrite()
Indicates if the underlying java.io.BufferedWriter should be flushed after each record is written.
|
FileWriter |
setAutoCloseWriter(boolean autoCloseWriter)
Indicates if the underlying output stream should be closed when this stream closes (defaults to true).
|
FileWriter |
setFlushOnWrite(boolean flushOnWrite)
Indicates if the underlying java.io.BufferedWriter should be flushed after each record is written.
|
static Record |
write(DataOutput out,
Record record) |
protected void |
writeImpl(Record record)
Overridden by subclasses to write the specified record to this
DataWriter . |
available, getNestedEndpoint, getNestedWriter, getRootEndpoint, getRootWriter, write
decrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, open, resetRecordCount, toString
addElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescription
public FileWriter(File file, boolean append, boolean compressed)
file
- the file to write or append to.append
- Indicates if writing should start at the end of the file (if it exists).compressed
- Indicates if the data should be compressed as it is being written (default false).public FileWriter(OutputStream outputStream, boolean compressed)
outputStream
- the stream to write to.compressed
- Indicates if the data should be compressed as it is being written.public FileWriter(File file, boolean append)
public FileWriter(File file)
public FileWriter(DataOutput out)
public static Record write(DataOutput out, Record record)
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
public boolean isAppend()
public boolean isFlushOnWrite()
public FileWriter setFlushOnWrite(boolean flushOnWrite)
public boolean isAutoCloseWriter()
public FileWriter setAutoCloseWriter(boolean autoCloseWriter)
public boolean isCompressed()
public void close()
DataEndpoint
close
in class DataEndpoint
protected void writeImpl(Record record) throws Throwable
DataWriter
DataWriter
.writeImpl
in class DataWriter
Throwable
Copyright (c) 2006-2023 North Concepts Inc. All Rights Reserved.