public abstract class AbstractSampleWriter extends SampleWriter
Handles buffering and output writer replacement.
When a writer is set on the sample writer any previous writer is flushed and closed before being replaced by the new one.
Modifier and Type | Field and Description |
---|---|
protected PrintWriter |
writer
output writer to write samples to
|
Constructor and Description |
---|
AbstractSampleWriter() |
Modifier and Type | Method and Description |
---|---|
void |
close()
This method is guaranteed to not throw any exception.
|
void |
setOutputFile(File output)
Set the destination file in which this sample writer will write samples
|
void |
setOutputStream(OutputStream out)
Instructs this sample writer to write samples on the specified output
with UTG-8 encoding.
|
void |
setWriter(Writer newWriter)
Set the new writer on which samples will be written by this sample writer.
If any writer exists on the sample writer, it is flushed and closed before being replaced by the new one. |
write
protected PrintWriter writer
public void setWriter(Writer newWriter)
newWriter
- The destination writer where samples will be written by this
sample writerpublic void setOutputStream(OutputStream out)
SaveService.getFileEncoding(String)
out
- The output stream on which sample should be writtenpublic void setOutputFile(File output)
output
- The output file that will receive samples written by this
sample writerpublic void close()
Copyright (c) 1998-2021 Apache Software Foundation. All Rights Reserved.