public class SerialWriter extends Object
Ideally, this class should be completely independent of CDM code so that Non-NetcdfDataset writers can be accomodated.
| Modifier and Type | Field and Description |
|---|---|
protected Checksum |
checksum |
protected dap4.core.data.ChecksumMode |
checksummode |
protected ByteBuffer |
countbuffer |
protected ByteBuffer |
crcbuffer |
static boolean |
DEBUG |
protected int |
depth |
static boolean |
DUMPCSUM |
static boolean |
DUMPDATA |
protected String |
lastchecksum |
protected ByteOrder |
order |
protected OutputStream |
output |
protected boolean |
serialize |
| Constructor and Description |
|---|
SerialWriter(OutputStream output,
ByteOrder order,
dap4.core.data.ChecksumMode mode) |
| Modifier and Type | Method and Description |
|---|---|
static ByteBuffer |
encodeArray(dap4.core.dmr.DapType vtype,
Object values,
ByteOrder order)
Encode an array of primitive values.
|
void |
endGroup() |
void |
endVariable() |
void |
flush() |
String |
getLastChecksum() |
void |
noSerialize(boolean tf) |
void |
outputBytes(byte[] bytes,
int start,
int count)
Deliberate choke point for debugging
|
void |
startGroup() |
void |
startVariable() |
void |
writeAtomicArray(dap4.core.dmr.DapType daptype,
Object values)
Write out an array of atomic values
|
void |
writeBytes(byte[] bytes,
int len)
Write out a set of bytes
|
void |
writeCount(long count)
Write out a prefix count
|
public static boolean DEBUG
public static boolean DUMPDATA
public static boolean DUMPCSUM
protected ByteOrder order
protected OutputStream output
protected int depth
protected Checksum checksum
protected dap4.core.data.ChecksumMode checksummode
protected boolean serialize
protected String lastchecksum
protected ByteBuffer crcbuffer
protected ByteBuffer countbuffer
public SerialWriter(OutputStream output, ByteOrder order, dap4.core.data.ChecksumMode mode)
public void noSerialize(boolean tf)
public String getLastChecksum()
public static ByteBuffer encodeArray(dap4.core.dmr.DapType vtype, Object values, ByteOrder order) throws IOException
vtype - The type of the objectvalues - The value arrayIOExceptionpublic void startGroup()
public void endGroup()
public void startVariable()
public void endVariable()
throws IOException
IOExceptionpublic void writeCount(long count)
throws IOException
count - the count to write outIOExceptionpublic void writeAtomicArray(dap4.core.dmr.DapType daptype,
Object values)
throws IOException
daptype - type of the valuesvalues - the array of valuesIOExceptionpublic void writeBytes(byte[] bytes,
int len)
throws IOException
bytes - len - IOExceptionpublic void outputBytes(byte[] bytes,
int start,
int count)
throws IOException
bytes - start - count - IOExceptionpublic void flush()
throws IOException
IOException