public abstract class NdfWriter<C extends ApplicationContext> extends AbstractAsyncExecutable<C> implements NdfConstants, java.io.Closeable
performWrite() in order to
write the NDF data.| Modifier and Type | Field and Description |
|---|---|
char |
defaultBlockCommentFillChar |
char |
defaultLineCommentFillChar |
static NdfTable.Alignment |
LEFT |
static NdfTable.Alignment |
RIGHT |
childTaskRef, isTestMode, monitorController, resultRef, stateFlagallowedInNames, blockCommentChar, booleanFalseChar, booleanFalseLiteral, booleanTrueChar, booleanTrueLiteral, currentNdfDocVersion, defaultTextEndChar, defaultTextParagraphChar, lineCommentChar, ndfDocAuthorKey, ndfDocCreatedKey, ndfDocEncodingKey, ndfDocTypeKey, ndfDocVersionKey, nullLiteral, quotingBreakCodes, standardBreakCodes, structureChar, textValueBreakCodes, validTextBreakSymbols| Constructor and Description |
|---|
NdfWriter(C ctx,
java.io.ByteArrayOutputStream stream) |
NdfWriter(C ctx,
java.io.ByteArrayOutputStream stream,
boolean isAppendMode) |
NdfWriter(C ctx,
java.io.ByteArrayOutputStream stream,
int buffSize) |
NdfWriter(C ctx,
java.io.File file) |
NdfWriter(C ctx,
java.io.File file,
boolean isAppendMode) |
NdfWriter(C ctx,
FileInfo fileInfo,
java.io.OutputStream stream) |
NdfWriter(C ctx,
FileInfo fileInfo,
java.io.OutputStream stream,
int buffSize) |
NdfWriter(C ctx,
java.io.File file,
int buffSize) |
NdfWriter(C ctx,
java.io.File file,
int buffSize,
boolean isAppendMode) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the output file.
|
void |
closeArray()
Closes the ARRAY structure.
|
void |
closeBlockComment()
Closes the comment block by inserting a titled separator-headline
ending with the block-comment-char '$'.
|
void |
closeBlockComment(java.lang.String title)
Closes the comment block by inserting a titled separator-headline
ending with the block-comment-char '$'.
|
void |
closeDocument()
Closes the document.
|
void |
closeList()
Closes a LIST structure.
|
void |
closeObject()
Opens an OBJECT structure.
|
void |
closePropertyList()
Closes a property-list by writing the '>' char.
|
void |
closeStructuredArrayProperty() |
void |
closeStructuredObjectProperty() |
void |
closeStructuredTableProperty() |
void |
closeTable()
Closes a TABLE structure.
|
void |
closeText()
Closes a TEXT structure.
|
void |
executeAsync()
Contains the code to be executed asynchronously.
|
void |
flush() |
java.lang.String |
getEncoding()
Returns the character encoding being used, null if not set.
|
java.io.File |
getOutputFile() |
long |
getWriteDuration() |
boolean |
isWriteBodyTextRaw()
Tells whether body text is written in raw mode - just as it is.
|
void |
openArray(java.lang.String name,
int... dimensions)
Opens an ARRAY structure.
|
void |
openArray(java.lang.String name,
NdfProperties props,
int... dimensions)
Opens an ARRAY structure.
|
void |
openBlockComment(int headerWidth,
java.lang.String title) |
void |
openBlockComment(java.lang.String title)
Opens the comment block by inserting the block-comment-char '$'
and a titled separator-headline.
|
void |
openDocument()
Writes the mandatory document header properties.
|
void |
openDocument(NdfProperties userProps)
Writes the mandatory document header properties.
|
void |
openList(java.lang.String listName)
Opens a LIST structure by writing the structure-key and the listName.
|
void |
openList(java.lang.String listName,
NdfProperties props) |
void |
openObject(java.lang.String name)
Opens an OBJECT structure by writing the structure-key and the objectName.
|
void |
openObject(java.lang.String name,
NdfProperties props) |
void |
openOutput()
Opens the output file.
|
void |
openPropertyList()
Opens a property-list by writing the '<' char.
|
void |
openStructuredArrayProperty(java.lang.String propertyKey,
java.lang.String arrayName,
int... dimensions)
Writes a property who's value is an ARRAY structure.
|
void |
openStructuredObjectProperty(java.lang.String propertyKey,
java.lang.String objectName)
Writes a property who's value is an OBJECT structure.
|
void |
openStructuredTableProperty(java.lang.String propertyKey,
NdfTable header)
Writes a property who's value is a TABLE structure.
|
void |
openStructuredTableProperty(java.lang.String propertyKey,
NdfTable header,
NdfProperties props) |
void |
openTable(NdfTable header)
Opens a TABLE structure by writing the structure-key, the tableName and the column-headers.
|
void |
openTable(NdfTable header,
NdfProperties props) |
void |
openText(java.lang.String name)
Opens a TEXT structure.
|
void |
openText(java.lang.String name,
char endChar) |
void |
openText(java.lang.String name,
char paragraphChar,
char endChar) |
void |
openText(java.lang.String name,
NdfProperties props) |
void |
openText(java.lang.String name,
NdfProperties props,
char endChar) |
void |
openText(java.lang.String name,
NdfProperties props,
char endChar,
char paragraphChar) |
protected abstract void |
performWrite()
This method does the actual write of data.
|
void |
setAppendMode(boolean isAppendMode) |
void |
setArrayValuesTabbed(boolean isTabbed)
If true, then a TAB character is used as array value separator.
|
void |
setDecimalFormat(java.text.DecimalFormat format)
Defines the format for writing decimal array values
|
void |
setDefaultCommentHeaderLength(int length)
Defines the default length of a comment header for both block and line comments.
|
void |
setEncoding(java.lang.String encoding)
Defines the character encoding to be used.
|
void |
setFillCharForBlockCommentHeader(char fillChar)
Defines the fill char for block-comment header- and footer-lines.
|
void |
setFillCharForLineCommentHeader(char fillChar)
Defines the fill char for line comment headers.
|
void |
setFixedCreationTimestamp(DBTimestamp timestamp)
Enforces the given timestamp to be taken written as the creation time.
|
void |
setLogChannel(LogChannel logCh) |
void |
setMaxArrayValuesByLine(int maxValues)
Sets the maximum number of array values written into one line.
|
void |
setMaxListValuesByLine(int maxValues)
Sets the maximum number of list values written into one line.
|
void |
setPropertiesAligned(boolean isAligned)
Causes properties to be written aligned based on their
maximum key size.
|
void |
setPropertiesCompacted(boolean isSingleLine)
Causes properties to be written into a single line.
|
void |
setPropertiesIndented(boolean isIndented)
Causes properties to get an indentation.
|
void |
setTableValuesTabbed(boolean isTabbed)
If true, then a TAB character is used as table value separator.
|
void |
setUseObjectShortCut(boolean useShortCut) |
void |
setWriteBodyTextRaw(boolean isRaw)
Switches off body text optimization which speeds up writing.
|
void |
writeArrayValue(java.lang.Object value)
Writes a single array value.
|
void |
writeArrayValues(java.util.Collection<?> values) |
void |
writeArrayValues(double[] values) |
void |
writeArrayValues(float[] values) |
void |
writeArrayValues(int[] values) |
void |
writeArrayValues(long[] values) |
void |
writeArrayValues(java.lang.Object... values)
Writes array values.
|
void |
writeArrayValues(short[] values) |
void |
writeArrayValues(java.lang.String[] values) |
void |
writeBlockComment(int headerWidth,
java.util.List<java.lang.String> lines) |
void |
writeBlockComment(int headerWidth,
java.lang.String text) |
void |
writeBlockComment(int headerWidth,
java.lang.String[] lines)
Writes the text as a block comment embedding it into a leading
and trailing block-comment-char '$'.
|
void |
writeBlockComment(java.util.List<java.lang.String> lines)
Writes the text as a block comment embedding it into a leading
and trailing block-comment-char '$'.
|
void |
writeBlockComment(java.lang.String text)
Writes the text as a block comment embedding it into a leading
and trailing block-comment-char '$'.
|
void |
writeComment(java.lang.String line)
Writes a single comment line prefixed by a '#' character.
|
void |
writeCommentHeader() |
void |
writeCommentHeader(int chars) |
void |
writeCommentHeader(int chars,
char separator) |
void |
writeLine()
Writes a new-line character.
|
void |
writeLine(java.lang.String line)
Writes a line of text without any indentation.
|
void |
writeListValue(java.lang.Object value)
Writes a single list value.
|
void |
writeListValues(java.util.Collection<?> values)
Writes the content of a collection as list values.
|
void |
writeListValues(java.lang.Object... values)
Writes the content of an array as list values.
|
void |
writeProperties(NdfProperties props) |
void |
writeProperty(java.lang.String key,
java.lang.Object... values)
Writes a single property and it's value or multiple values respectively.
|
void |
writePropertyList(NdfProperties props)
Opens a property-list, writes all the given properties and closes the list.
|
void |
writeTableRow(java.util.Collection<?> values)
Writes the row values of a table.
|
void |
writeTableRow(java.lang.Object... values)
Writes the row values of a table.
|
void |
writeText(java.util.List<java.lang.String> textLines) |
void |
writeText(java.lang.String text) |
addMonitor, checkCancelled, checkForErrorAndRethrow, clearMonitors, createRunStateFlag, doOnCancel, doOnFailure, execute, executeSubTask, getError, getMaxProgressSteps, getMonitorCount, getMonitors, getName, getProgressStepCount, getResult, getRunStateFlag, getTaskId, getType, handleCancellation, handleFailure, handleFinish, handleStart, handleSuccess, hasError, hasMonitor, isCancellable, notifyProceeded, registerTaskStateChange, removeMonitor, resetProgress, setCancellable, setLogLevel, setMaxProgressSteps, setMonitor, setName, setName, setResult, setRunStateFlag, setTaskId, setType, shouldFireMonitor, sleepChecked, wasCancelledgetApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarningconfigureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetApplicationContextgetLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarningpublic static final NdfTable.Alignment RIGHT
public static final NdfTable.Alignment LEFT
public char defaultBlockCommentFillChar
public char defaultLineCommentFillChar
public NdfWriter(C ctx, java.io.File file)
public NdfWriter(C ctx, java.io.File file, boolean isAppendMode)
public NdfWriter(C ctx, java.io.File file, int buffSize)
public NdfWriter(C ctx, java.io.File file, int buffSize, boolean isAppendMode)
public NdfWriter(C ctx, java.io.ByteArrayOutputStream stream)
public NdfWriter(C ctx, java.io.ByteArrayOutputStream stream, int buffSize)
public NdfWriter(C ctx, java.io.ByteArrayOutputStream stream, boolean isAppendMode)
protected abstract void performWrite()
throws java.lang.Exception
java.lang.Exceptionpublic void setEncoding(java.lang.String encoding)
public java.lang.String getEncoding()
public final java.io.File getOutputFile()
public void setAppendMode(boolean isAppendMode)
public final void executeAsync()
throws java.lang.Exception
AsyncExecutableRunnable.run() for async execution.executeAsync in interface AsyncExecutable<C extends ApplicationContext>executeAsync in class AbstractAsyncExecutable<C extends ApplicationContext>java.lang.Exceptionfor synchronous executionpublic long getWriteDuration()
public final void openOutput()
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionclose()public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionopenOutput()public final void setLogChannel(LogChannel logCh)
setLogChannel in interface SimpleLogSupportsetLogChannel in class AbstractApplicationObject<C extends ApplicationContext>public void setFixedCreationTimestamp(DBTimestamp timestamp)
public void setFillCharForBlockCommentHeader(char fillChar)
public void setFillCharForLineCommentHeader(char fillChar)
public void setDefaultCommentHeaderLength(int length)
public final void setPropertiesIndented(boolean isIndented)
public final void setPropertiesCompacted(boolean isSingleLine)
public final void setPropertiesAligned(boolean isAligned)
public void setUseObjectShortCut(boolean useShortCut)
public boolean isWriteBodyTextRaw()
public final void setWriteBodyTextRaw(boolean isRaw)
public final void setArrayValuesTabbed(boolean isTabbed)
public final void setTableValuesTabbed(boolean isTabbed)
public final void setMaxArrayValuesByLine(int maxValues)
public final void setMaxListValuesByLine(int maxValues)
public final void setDecimalFormat(java.text.DecimalFormat format)
public final void writeLine()
throws java.lang.Exception
java.lang.Exceptionpublic final void writeLine(java.lang.String line)
throws java.lang.Exception
java.lang.Exceptionpublic final void openDocument()
throws java.lang.Exception
java.lang.Exceptionpublic final void openDocument(NdfProperties userProps) throws java.lang.Exception
java.lang.Exceptionpublic final void closeDocument()
throws java.lang.Exception
java.lang.Exceptionpublic final void openPropertyList()
throws java.lang.Exception
java.lang.Exceptionpublic final void closePropertyList()
throws java.lang.Exception
java.lang.Exceptionpublic final void writePropertyList(NdfProperties props) throws java.lang.Exception
java.lang.ExceptionsetPropertiesAligned(boolean),
setPropertiesCompacted(boolean)public final void writeProperties(NdfProperties props) throws java.lang.Exception
java.lang.Exceptionpublic final void writeProperty(java.lang.String key,
java.lang.Object... values)
throws java.lang.Exception
java.lang.Exceptionpublic final void openStructuredObjectProperty(java.lang.String propertyKey,
java.lang.String objectName)
throws java.lang.Exception
openObject(String).java.lang.ExceptioncloseStructuredObjectProperty().public final void closeStructuredObjectProperty()
throws java.lang.Exception
java.lang.ExceptionopenStructuredObjectProperty(String, String).public final void openStructuredTableProperty(java.lang.String propertyKey,
NdfTable header)
throws java.lang.Exception
openTable(NdfTable, NdfProperties).java.lang.ExceptioncloseStructuredTableProperty().public final void openStructuredTableProperty(java.lang.String propertyKey,
NdfTable header,
NdfProperties props)
throws java.lang.Exception
java.lang.Exceptionpublic final void closeStructuredTableProperty()
throws java.lang.Exception
java.lang.ExceptionopenStructuredTableProperty(String, NdfTable, NdfProperties).,
openStructuredTableProperty(String, NdfTable).public final void openStructuredArrayProperty(java.lang.String propertyKey,
java.lang.String arrayName,
int... dimensions)
throws java.lang.Exception
openArray(String, int...).java.lang.ExceptioncloseStructuredArrayProperty().public final void closeStructuredArrayProperty()
throws java.lang.Exception
java.lang.ExceptionopenStructuredArrayProperty(String, String, int...).public final void writeCommentHeader()
throws java.lang.Exception
java.lang.Exceptionpublic final void writeCommentHeader(int chars)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeCommentHeader(int chars,
char separator)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeComment(java.lang.String line)
throws java.lang.Exception
openBlockComment(String) call,
then an indented block comment line is written instead.java.lang.ExceptionopenBlockComment(String),
closeBlockComment()public final void openBlockComment(java.lang.String title)
throws java.lang.Exception
java.lang.Exceptionpublic final void openBlockComment(int headerWidth,
java.lang.String title)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeBlockComment(java.lang.String text)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeBlockComment(int headerWidth,
java.lang.String text)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeBlockComment(java.util.List<java.lang.String> lines)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeBlockComment(int headerWidth,
java.util.List<java.lang.String> lines)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeBlockComment(int headerWidth,
java.lang.String[] lines)
throws java.lang.Exception
java.lang.Exceptionpublic final void closeBlockComment(java.lang.String title)
throws java.lang.Exception
java.lang.Exceptionpublic final void closeBlockComment()
throws java.lang.Exception
java.lang.Exceptionpublic final void openObject(java.lang.String name)
throws java.lang.Exception
java.lang.Exceptionpublic final void openObject(java.lang.String name,
NdfProperties props)
throws java.lang.Exception
java.lang.Exceptionpublic final void closeObject()
throws java.lang.Exception
java.lang.Exceptionpublic final void openTable(NdfTable header) throws java.lang.Exception
java.lang.Exceptionpublic final void openTable(NdfTable header, NdfProperties props) throws java.lang.Exception
java.lang.Exceptionpublic final void openList(java.lang.String listName)
throws java.lang.Exception
java.lang.Exceptionpublic final void openList(java.lang.String listName,
NdfProperties props)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeListValues(java.lang.Object... values)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeListValues(java.util.Collection<?> values)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeListValue(java.lang.Object value)
throws java.lang.Exception
java.lang.Exceptionpublic final void closeList()
throws java.lang.Exception
java.lang.Exceptionpublic final void writeTableRow(java.util.Collection<?> values)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeTableRow(java.lang.Object... values)
throws java.lang.Exception
java.lang.Exceptionpublic final void closeTable()
throws java.lang.Exception
java.lang.Exceptionpublic final void openArray(java.lang.String name,
int... dimensions)
throws java.lang.Exception
java.lang.Exceptionpublic final void openArray(java.lang.String name,
NdfProperties props,
int... dimensions)
throws java.lang.Exception
java.lang.Exceptionpublic final void openText(java.lang.String name)
throws java.lang.Exception
java.lang.Exceptionpublic final void openText(java.lang.String name,
char endChar)
throws java.lang.Exception
java.lang.Exceptionpublic final void openText(java.lang.String name,
NdfProperties props)
throws java.lang.Exception
java.lang.Exceptionpublic final void openText(java.lang.String name,
NdfProperties props,
char endChar)
throws java.lang.Exception
java.lang.Exceptionpublic final void openText(java.lang.String name,
char paragraphChar,
char endChar)
throws java.lang.Exception
java.lang.Exceptionpublic final void openText(java.lang.String name,
NdfProperties props,
char endChar,
char paragraphChar)
throws java.lang.Exception
java.lang.Exceptionpublic void writeText(java.util.List<java.lang.String> textLines)
throws java.lang.Exception
java.lang.Exceptionpublic void writeText(java.lang.String text)
throws java.lang.Exception
java.lang.Exceptionpublic final void closeText()
throws java.lang.Exception
java.lang.Exceptionpublic final void writeArrayValues(java.lang.Object... values)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeArrayValues(short[] values)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeArrayValues(int[] values)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeArrayValues(long[] values)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeArrayValues(float[] values)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeArrayValues(double[] values)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeArrayValues(java.lang.String[] values)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeArrayValues(java.util.Collection<?> values)
throws java.lang.Exception
java.lang.Exceptionpublic final void writeArrayValue(java.lang.Object value)
throws java.lang.Exception
java.lang.Exceptionpublic final void closeArray()
throws java.lang.Exception
java.lang.Exceptionpublic void flush()
throws java.io.IOException
java.io.IOExceptionCopyright © 2014 EsprIT-Systems. All Rights Reserved.