public class FixedWidthWriter extends LinedTextWriter
DataEndpoint.State
currentRecord
lastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEY
BUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZE
id, log, name, TIMESTAMP_FORMAT
Constructor and Description |
---|
FixedWidthWriter(File file) |
FixedWidthWriter(File file,
boolean append) |
FixedWidthWriter(Writer writer) |
Modifier and Type | Method and Description |
---|---|
DataException |
addExceptionProperties(DataException exception)
Adds this endpoint's current state to a
DataException . |
FixedWidthWriter |
addField(FixedWidthField field) |
FixedWidthWriter |
addField(int width,
FixedWidthAlign align,
char fillChar) |
FixedWidthWriter |
addFields(int... width) |
protected void |
assembleLine(Record record,
StringBuilder lineBuffer) |
char |
getFillChar() |
boolean |
isTruncateFields() |
FixedWidthWriter |
setAutoCloseWriter(boolean autoCloseWriter)
Indicates if the underlying java.io.BufferedWriter should be closed when this stream closes (defaults to true).
|
FixedWidthWriter |
setDescription(String description) |
FixedWidthWriter |
setFieldNamesInFirstRow(boolean fieldNamesInFirstRow) |
FixedWidthWriter |
setFillChar(char fillChar) |
FixedWidthWriter |
setFlushOnWrite(boolean flushOnWrite)
Indicates if the underlying java.io.BufferedWriter should be flushed after each record is written (defaults to false).
|
FixedWidthWriter |
setNewLine(String newLine)
Assigns the string used between each line (defaults to "\n" on Linux and "\r\n" on Windows).
|
FixedWidthWriter |
setTruncateFields(boolean truncateFields) |
getNewLine, writeRecord
close, getFile, getWriter, isAppend, isAutoCloseWriter, isFieldNamesInFirstRow, isFlushOnWrite, write
open, writeImpl
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
public FixedWidthWriter(File file, boolean append)
file
- append
- Indicates if writing should start at the end of the file (if it exists). If the specified file exists and has contents
(more than 0 bytes), then the fieldNamesInFirstRow
property will be set to false
.public FixedWidthWriter(File file)
public FixedWidthWriter(Writer writer)
public char getFillChar()
public FixedWidthWriter setFillChar(char fillChar)
public boolean isTruncateFields()
public FixedWidthWriter setTruncateFields(boolean truncateFields)
public FixedWidthWriter addField(FixedWidthField field)
public FixedWidthWriter addFields(int... width)
public FixedWidthWriter addField(int width, FixedWidthAlign align, char fillChar)
public FixedWidthWriter setFieldNamesInFirstRow(boolean fieldNamesInFirstRow)
setFieldNamesInFirstRow
in class AbstractWriter
public FixedWidthWriter setDescription(String description)
setDescription
in class Endpoint
public FixedWidthWriter setNewLine(String newLine)
LinedTextWriter
setNewLine
in class LinedTextWriter
public FixedWidthWriter setAutoCloseWriter(boolean autoCloseWriter)
TextWriter
setAutoCloseWriter
in class TextWriter
public FixedWidthWriter setFlushOnWrite(boolean flushOnWrite)
TextWriter
setFlushOnWrite
in class TextWriter
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 LinedTextWriter
protected void assembleLine(Record record, StringBuilder lineBuffer) throws Throwable
assembleLine
in class LinedTextWriter
Throwable
Copyright (c) 2006-2024 North Concepts Inc. All Rights Reserved.