step.io
Class StepEncodedOutput
java.lang.Object
|
+--step.io.StepEncodedOutput
- All Implemented Interfaces:
- StepRecordOutput
- public class StepEncodedOutput
- extends Object
- implements StepRecordOutput
An output stream for writing StepRecord
objects.
File Format
The file consists of a series of [size][record]
elements.
Records are encoded with a universal RecordEncoder
.
The size (in bytes) of the record data precedes the data itself, which
permits a reader to skip the record if it is
unwanted or its decoder is unavailable.
NOTE: Some records are MetaRecord
s, which contain a segmented record
along with interpretive meta-data. The format of a MetaRecord is:
[data1][data2][data3]...[meta1][meta2]...
, where the "meta"
portions are MetaEvent
records. MetaEvents indicate some form of
state change in the encoding/decoding process. MetaRecords are unpacked by
decoding a data segment, then interpreting the next MetaEvent. There are
always n-1 MetaEvents for n data segments.
NOTE: This class is not synchronized. When used in a multi-threaded
environment, the write process must be externally synchronized.
Failure to do so may result in corrupted data.
- See Also:
StepRecord
,
Encoder
,
StepEncodedInput
Method Summary |
void |
close()
Close this output stream. |
void |
flush()
Flush this output stream. |
(package private) static boolean |
verbose()
|
void |
writeRecord(StepRecord record)
NOTE: This operation is not synchronized. |
(package private) static int |
zipBufferSize()
|
(package private) static boolean |
zipData()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FILE_MAGIC
public static final byte[] FILE_MAGIC
FILE_VERSION
public static final byte[] FILE_VERSION
SIZE_ENCODER_NAME
public static final String SIZE_ENCODER_NAME
- See Also:
- Constant Field Values
RECORD_ENCODER_NAME
public static final String RECORD_ENCODER_NAME
- See Also:
- Constant Field Values
COMPRESSED_DATA
static final int COMPRESSED_DATA
- See Also:
- Constant Field Values
StepEncodedOutput
public StepEncodedOutput(OutputStream output)
throws IOException
writeRecord
public void writeRecord(StepRecord record)
throws IOException
- NOTE: This operation is not synchronized. When used in a multi-threaded
environment, the write process must be externally synchronized on this
object. Failure to do so may result in corrupted data.
- Specified by:
writeRecord
in interface StepRecordOutput
- Throws:
IOException
- if an internal I/O failure occurred.
close
public void close()
throws IOException
- Description copied from interface:
StepRecordOutput
- Close this output stream.
- Specified by:
close
in interface StepRecordOutput
IOException
flush
public void flush()
throws IOException
- Description copied from interface:
StepRecordOutput
- Flush this output stream.
- Specified by:
flush
in interface StepRecordOutput
IOException
verbose
static boolean verbose()
zipData
static boolean zipData()
zipBufferSize
static int zipBufferSize()