T - object type@Description(value="Writes objects to stdout or a file") @In(value=java.lang.Object.class) @Out(value=java.lang.Void.class) @FluxCommand(value="write") public final class ObjectWriter<T> extends java.lang.Object implements ConfigurableObjectWriter<T>
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
STDOUT |
DEFAULT_FOOTER, DEFAULT_HEADER, DEFAULT_SEPARATOR| Constructor and Description |
|---|
ObjectWriter(java.lang.String destination)
Sets the destination to write objects to.
|
| Modifier and Type | Method and Description |
|---|---|
void |
closeStream() |
static java.util.Collection<java.lang.String> |
getArguments()
Returns the available arguments.
|
FileCompression |
getCompression()
Returns the compression mode.
|
java.lang.String |
getEncoding()
Returns the encoding used by the underlying writer.
|
java.lang.String |
getFooter()
Returns the footer which is output after the last object.
|
java.lang.String |
getHeader()
Returns the header which is output before the first object.
|
java.lang.String |
getSeparator()
Returns the separator which is output between objects.
|
void |
process(T obj) |
void |
resetStream() |
void |
setAppendIfFileExists(boolean appendIfFileExists)
Controls whether to open files in append mode if they exist.
|
void |
setCompression(FileCompression compression)
Sets the compression mode.
|
void |
setCompression(java.lang.String compression)
Sets the compression mode.
|
void |
setEncoding(java.lang.String encoding)
Sets the encoding used by the underlying writer.
|
void |
setFooter(java.lang.String footer)
Sets the footer which is output after the last object.
|
void |
setHeader(java.lang.String header)
Sets the header which is output before the first object.
|
void |
setSeparator(java.lang.String separator)
Sets the separator which is output between objects.
|
public static final java.lang.String STDOUT
public ObjectWriter(java.lang.String destination)
destination - the path to be written to or standard out if it's
"stdout"@ReturnsAvailableArguments public static java.util.Collection<java.lang.String> getArguments()
public java.lang.String getEncoding()
ConfigurableObjectWritergetEncoding in interface ConfigurableObjectWriter<T>public void setEncoding(java.lang.String encoding)
ConfigurableObjectWritersetEncoding in interface ConfigurableObjectWriter<T>encoding - name of the encodingpublic FileCompression getCompression()
ConfigurableObjectWritergetCompression in interface ConfigurableObjectWriter<T>public void setCompression(FileCompression compression)
ConfigurableObjectWritersetCompression in interface ConfigurableObjectWriter<T>compression - type of compressionpublic void setCompression(java.lang.String compression)
ConfigurableObjectWritersetCompression in interface ConfigurableObjectWriter<T>compression - type of compressionpublic java.lang.String getHeader()
ConfigurableObjectWritergetHeader in interface ConfigurableObjectWriter<T>public void setHeader(java.lang.String header)
ConfigurableObjectWritersetHeader in interface ConfigurableObjectWriter<T>header - new header stringpublic java.lang.String getFooter()
ConfigurableObjectWritergetFooter in interface ConfigurableObjectWriter<T>public void setFooter(java.lang.String footer)
ConfigurableObjectWritersetFooter in interface ConfigurableObjectWriter<T>footer - new footer stringpublic java.lang.String getSeparator()
ConfigurableObjectWritergetSeparator in interface ConfigurableObjectWriter<T>public void setSeparator(java.lang.String separator)
ConfigurableObjectWritersetSeparator in interface ConfigurableObjectWriter<T>separator - new separator stringpublic void setAppendIfFileExists(boolean appendIfFileExists)
appendIfFileExists - true if new data should be appended,
false to overwrite the existing fileObjectFileWriter.setAppendIfFileExists(boolean)public void process(T obj)
process in interface org.metafacture.framework.ObjectReceiver<T>public void resetStream()
resetStream in interface org.metafacture.framework.LifeCyclepublic void closeStream()
closeStream in interface org.metafacture.framework.LifeCycle