Package com.redwood.agent.api.rtx
Class RTXWriter
- java.lang.Object
- 
- com.redwood.agent.api.rtx.RTXWriter
 
- 
- All Implemented Interfaces:
- RTXConsumer,- Closeable,- AutoCloseable
 
 public class RTXWriter extends Object implements RTXConsumer Writer for RTX format.
- 
- 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddColumn(RTXColumn column)Add a new column with the name and type of an existing column, the column will be added to the end of this metadata (i.e.voidaddColumn(String columnName, RTXType columnType)Add a new column with the specified name and type, the column will be added to the end of this metadata.voidaddColumn(String columnName, String columnType)Add a new column with the specified name and type, the column will be added to the end of this metadata.voidaddColumns(Collection<RTXColumn> newColumns)Add new columns based on the input columns, the columns will be added in the order that they occur in the list, to the end of this metadata (i.e.voidaddRow(RTXRow row)Adds arowvoidaddRow(Object[] data)Adds arowwith the supplied data, where the row will not have a key.voidaddRow(Object[] data, String key)Adds arowwith the supplied data and key.voidaddSource(RTXSource source)Add a source to theRTXMetadata, which is set previously withRTXConsumer.setMetadata(RTXMetadata)voidaddSources(Collection<RTXSource> sources, String prefix)Convenience method to add multiple sources, with a prefix, to theRTXMetadata, which is set previously withRTXConsumer.setMetadata(RTXMetadata)voidclose()voidflush()Write any cached data to the underlying output mechanism.RTXMetadatagetMetadata()intgetRowNumber()voidsetLogger(Logger newLog)Replace the default logger with anotherLogger.voidsetMetadata(RTXMetadata newMetadata)Sets theRTXMetadata.voidsetWriteComments(boolean newValue)- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface com.redwood.agent.api.rtx.RTXConsumeraddSources, addSources, addSources, copyColumns, newRow
 
- 
 
- 
- 
- 
Constructor Detail- 
RTXWriterpublic RTXWriter(OutputStream newOutputStream) throws RTXWriterException - Throws:
- RTXWriterException
 
 - 
RTXWriterpublic RTXWriter(Writer newWriter) throws RTXWriterException - Throws:
- RTXWriterException
 
 - 
RTXWriterpublic RTXWriter(String filename) throws RTXWriterException, FileNotFoundException 
 
- 
 - 
Method Detail- 
setWriteCommentspublic void setWriteComments(boolean newValue) 
 - 
setLoggerpublic void setLogger(Logger newLog) Description copied from interface:RTXConsumerReplace the default logger with anotherLogger.- Specified by:
- setLoggerin interface- RTXConsumer
 
 - 
addColumnpublic void addColumn(RTXColumn column) throws RTXMetadataRuntimeException, RTXInRowDataRuntimeException, RTXMetadataReadOnlyRuntimeException Description copied from interface:RTXConsumerAdd a new column with the name and type of an existing column, the column will be added to the end of this metadata (i.e. the index of the input column is ignored).- Specified by:
- addColumnin interface- RTXConsumer
- Parameters:
- column- the column to get the name and type from.
- Throws:
- RTXMetadataRuntimeException- if an error occurs.
- RTXInRowDataRuntimeException- when already data have been added. It is not allowed to add a new- columnto the- RTXMetadata, when already- RTXRowshave been added.
- RTXMetadataReadOnlyRuntimeException- if the metadata is read-only.
 
 - 
addColumnpublic void addColumn(String columnName, String columnType) throws RTXMetadataRuntimeException, RTXInRowDataRuntimeException, RTXMetadataReadOnlyRuntimeException Description copied from interface:RTXConsumerAdd a new column with the specified name and type, the column will be added to the end of this metadata.- Specified by:
- addColumnin interface- RTXConsumer
- Parameters:
- columnName- the column name.
- columnType- the column type.
- Throws:
- RTXMetadataRuntimeException- if an error occurs.
- RTXInRowDataRuntimeException- when already data have been added. It is not allowed to add a new- columnto the- RTXMetadata, when already- RTXRowshave been added.
- RTXMetadataReadOnlyRuntimeException- if the metadata is read-only.
 
 - 
addColumnpublic void addColumn(String columnName, RTXType columnType) throws RTXMetadataRuntimeException, RTXInRowDataRuntimeException, RTXMetadataReadOnlyRuntimeException Description copied from interface:RTXConsumerAdd a new column with the specified name and type, the column will be added to the end of this metadata.- Specified by:
- addColumnin interface- RTXConsumer
- Parameters:
- columnName- the column name.
- columnType- the column type.
- Throws:
- RTXMetadataRuntimeException- if an error occurs.
- RTXInRowDataRuntimeException- when already data have been added. It is not allowed to add a new- columnto the- RTXMetadata, when already- RTXRowshave been added.
- RTXMetadataReadOnlyRuntimeException- if the metadata is read-only.
 
 - 
addColumnspublic void addColumns(Collection<RTXColumn> newColumns) throws RTXMetadataRuntimeException, RTXMetadataReadOnlyRuntimeException Description copied from interface:RTXConsumerAdd new columns based on the input columns, the columns will be added in the order that they occur in the list, to the end of this metadata (i.e. the index of on each input column is ignored).- Specified by:
- addColumnsin interface- RTXConsumer
- Parameters:
- newColumns- the columns to get the name and type from.
- Throws:
- RTXMetadataRuntimeException- if an error occurs.
- RTXMetadataReadOnlyRuntimeException- if the metadata is read-only.
 
 - 
addRowpublic void addRow(Object[] data) throws RTXWriterException, RTXColumnRuntimeException Description copied from interface:RTXConsumerAdds arowwith the supplied data, where the row will not have a key.- Specified by:
- addRowin interface- RTXConsumer
- Parameters:
- data- the values for the different cells in the new row. When the row has more columns than supplied in- data, then the rest of the cells will be empty.
- Throws:
- RTXWriterException
- RTXColumnRuntimeException
 
 - 
addRowpublic void addRow(Object[] data, String key) throws RTXWriterException, RTXColumnRuntimeException Description copied from interface:RTXConsumerAdds arowwith the supplied data and key.- Specified by:
- addRowin interface- RTXConsumer
- Parameters:
- data-
- key- the optional key of this row, which is only a label and can be used as reference to other data structures. No uniqueness is provided and keys cannot be used to access rows directly.
- Throws:
- RTXWriterException
- RTXColumnRuntimeException
 
 - 
addRowpublic void addRow(RTXRow row) throws RTXWriterException, RTXColumnRuntimeException Description copied from interface:RTXConsumerAdds arow- Specified by:
- addRowin interface- RTXConsumer
- Throws:
- RTXWriterException
- RTXColumnRuntimeException
 
 - 
addSourcepublic void addSource(RTXSource source) throws RTXMetadataRuntimeException, RTXInRowDataRuntimeException, RTXMetadataReadOnlyRuntimeException Description copied from interface:RTXConsumerAdd a source to theRTXMetadata, which is set previously withRTXConsumer.setMetadata(RTXMetadata)- Specified by:
- addSourcein interface- RTXConsumer
- Throws:
- RTXMetadataRuntimeException- if an error occurs.
- RTXInRowDataRuntimeException- when already data have been added. It is not allowed to add a new- sourceto the- RTXMetadata, when already- RTXRowshave been added.
- RTXMetadataReadOnlyRuntimeException- if the metadata is read-only.
- See Also:
- RTXConsumer.setMetadata(RTXMetadata)
 
 - 
addSourcespublic void addSources(Collection<RTXSource> sources, String prefix) throws RTXMetadataRuntimeException, RTXInRowDataRuntimeException, RTXMetadataReadOnlyRuntimeException Description copied from interface:RTXConsumerConvenience method to add multiple sources, with a prefix, to theRTXMetadata, which is set previously withRTXConsumer.setMetadata(RTXMetadata)- Specified by:
- addSourcesin interface- RTXConsumer
- Throws:
- RTXMetadataRuntimeException- if an error occurs.
- RTXInRowDataRuntimeException- when already data have been added. It is not allowed to add a new- sourceto the- RTXMetadata, when already- RTXRowshave been added.
- RTXMetadataReadOnlyRuntimeException- if the metadata is read-only.
- See Also:
- RTXConsumer.addSource(RTXSource),- RTXConsumer.setMetadata(RTXMetadata)
 
 - 
closepublic void close() - Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Specified by:
- closein interface- RTXConsumer
 
 - 
flushpublic void flush() throws XMLStreamExceptionDescription copied from interface:RTXConsumerWrite any cached data to the underlying output mechanism.- Specified by:
- flushin interface- RTXConsumer
- Throws:
- XMLStreamException
 
 - 
getMetadatapublic RTXMetadata getMetadata() - Specified by:
- getMetadatain interface- RTXConsumer
- Returns:
- the RTXMetadata
- See Also:
- RTXConsumer.setMetadata(RTXMetadata)
 
 - 
setMetadatapublic void setMetadata(RTXMetadata newMetadata) throws RTXColumnRuntimeException, RTXInRowDataRuntimeException Description copied from interface:RTXConsumerSets theRTXMetadata. This is not allowed anymore, when data was already added, but needs to be set before any data is added.- Specified by:
- setMetadatain interface- RTXConsumer
- Throws:
- RTXColumnRuntimeException
- RTXInRowDataRuntimeException- when already data have been added. It is not allowed to set new- RTXMetadata, when already- RTXRowshave been added.
- See Also:
- RTXConsumer.getMetadata()
 
 - 
getRowNumberpublic final int getRowNumber() - Specified by:
- getRowNumberin interface- RTXConsumer
- Returns:
- the current row number, i.e. the row number of added rows. Initially it returns 0, meaning no row has been added.
 
 
- 
 
-