Package dap4.servlet
Class SerialWriter
- java.lang.Object
-
- dap4.servlet.SerialWriter
-
public class SerialWriter extends Object
The SerialWriter class is intended to provide the API through which various kinds of data are written into the ChunkWriter.Ideally, this class should be completely independent of CDM code so that Non-NetcdfDataset writers can be accomodated.
-
-
Field Summary
Fields Modifier and Type Field Description protected Checksumchecksumprotected dap4.core.util.ChecksumModechecksummodeprotected ByteBuffercountbufferprotected ByteBuffercrcbufferstatic booleanDEBUGprotected intdepthstatic booleanDUMPCSUMstatic booleanDUMPDATAprotected longlastchecksumprotected ByteOrderorderprotected OutputStreamoutputprotected booleanserialize
-
Constructor Summary
Constructors Constructor Description SerialWriter(OutputStream output, ByteOrder order, dap4.core.util.ChecksumMode mode)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ByteBufferencodeArray(dap4.core.dmr.DapType vtype, Object values, ByteOrder order)Encode an array of primitive values.voidendGroup()voidendVariable()voidflush()longgetLastChecksum()voidnoSerialize(boolean tf)voidoutputBytes(byte[] bytes, int start, int count)Deliberate choke point for debuggingvoidstartGroup()voidstartVariable()voidwriteAtomicArray(dap4.core.dmr.DapType daptype, Object values)Write out an array of atomic valuesvoidwriteBytes(byte[] bytes, int len)Write out a set of bytesvoidwriteCount(long count)Write out a prefix count
-
-
-
Field Detail
-
DEBUG
public static boolean DEBUG
-
DUMPDATA
public static boolean DUMPDATA
-
DUMPCSUM
public static boolean DUMPCSUM
-
order
protected ByteOrder order
-
output
protected OutputStream output
-
depth
protected int depth
-
checksum
protected Checksum checksum
-
checksummode
protected dap4.core.util.ChecksumMode checksummode
-
serialize
protected boolean serialize
-
lastchecksum
protected long lastchecksum
-
crcbuffer
protected ByteBuffer crcbuffer
-
countbuffer
protected ByteBuffer countbuffer
-
-
Constructor Detail
-
SerialWriter
public SerialWriter(OutputStream output, ByteOrder order, dap4.core.util.ChecksumMode mode)
-
-
Method Detail
-
noSerialize
public void noSerialize(boolean tf)
-
getLastChecksum
public long getLastChecksum()
-
encodeArray
public static ByteBuffer encodeArray(dap4.core.dmr.DapType vtype, Object values, ByteOrder order) throws IOException
Encode an array of primitive values.- Parameters:
vtype- The type of the objectvalues- The value array- Returns:
- bytebuffer encoding of the array using the platform's native encoding.
- Throws:
IOException
-
startGroup
public void startGroup()
-
endGroup
public void endGroup()
-
startVariable
public void startVariable()
-
endVariable
public void endVariable() throws IOException- Throws:
IOException
-
writeCount
public void writeCount(long count) throws IOExceptionWrite out a prefix count- Parameters:
count- the count to write out- Throws:
IOException
-
writeAtomicArray
public void writeAtomicArray(dap4.core.dmr.DapType daptype, Object values) throws IOExceptionWrite out an array of atomic values- Parameters:
daptype- type of the valuesvalues- the array of values- Throws:
IOException
-
writeBytes
public void writeBytes(byte[] bytes, int len) throws IOExceptionWrite out a set of bytes- Parameters:
bytes-len-- Throws:
IOException
-
outputBytes
public void outputBytes(byte[] bytes, int start, int count) throws IOExceptionDeliberate choke point for debugging- Parameters:
bytes-start-count-- Throws:
IOException
-
flush
public void flush() throws IOException- Throws:
IOException
-
-