Package dap4.dap4lib.serial
Class D4DataCompiler
- java.lang.Object
-
- dap4.dap4lib.serial.D4DataCompiler
-
public class D4DataCompiler extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected dap4.core.data.ChecksumModechecksummodestatic intCOUNTSIZEprotected ByteBufferdatabufferprotected dap4.core.dmr.DapDatasetdatasetstatic booleanDEBUGprotected D4DSPdspprotected ByteOrderorder
-
Constructor Summary
Constructors Constructor Description D4DataCompiler(D4DSP dsp, dap4.core.data.ChecksumMode checksummode, ByteOrder order, ByteBuffer databuffer)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcompile()The goal here is to process the serialized databuffer and locate top-level variable positions in the serialized databuffer.protected D4CursorcompileAtomicVar(dap4.core.dmr.DapVariable var, D4Cursor container)D4CursorcompileSequence(dap4.core.dmr.DapVariable var, dap4.core.dmr.DapSequence dapseq, D4Cursor container)Compile a sequence as a set of records.protected D4CursorcompileSequenceArray(dap4.core.dmr.DapVariable var, D4Cursor container)Compile a sequence array.protected D4CursorcompileStructure(dap4.core.dmr.DapVariable var, dap4.core.dmr.DapStructure dapstruct, D4Cursor container)Compile a structure instance.protected D4CursorcompileStructureArray(dap4.core.dmr.DapVariable var, D4Cursor container)Compile a structure array.protected D4CursorcompileVar(dap4.core.dmr.DapVariable dapvar, D4Cursor container)protected static intcomputeTypeSize(dap4.core.dmr.DapType daptype)Compute the size in databuffer of the serialized formprotected intextractChecksum(ByteBuffer data)protected static intgetCount(ByteBuffer data)protected static intgetPos(ByteBuffer data)protected static voidskip(ByteBuffer data, int count)protected static longwalkByteStrings(long[] positions, ByteBuffer databuffer)
-
-
-
Field Detail
-
DEBUG
public static boolean DEBUG
-
COUNTSIZE
public static final int COUNTSIZE
- See Also:
- Constant Field Values
-
dataset
protected dap4.core.dmr.DapDataset dataset
-
databuffer
protected ByteBuffer databuffer
-
checksummode
protected dap4.core.data.ChecksumMode checksummode
-
order
protected ByteOrder order
-
dsp
protected D4DSP dsp
-
-
Constructor Detail
-
D4DataCompiler
public D4DataCompiler(D4DSP dsp, dap4.core.data.ChecksumMode checksummode, ByteOrder order, ByteBuffer databuffer) throws dap4.core.util.DapException
Constructor- Parameters:
dsp- the D4DSPchecksummode-databuffer- the source of serialized databuffer- Throws:
dap4.core.util.DapException
-
-
Method Detail
-
compile
public void compile() throws dap4.core.util.DapExceptionThe goal here is to process the serialized databuffer and locate top-level variable positions in the serialized databuffer. Access to non-top-level variables is accomplished on the fly.- Throws:
dap4.core.util.DapException
-
compileVar
protected D4Cursor compileVar(dap4.core.dmr.DapVariable dapvar, D4Cursor container) throws dap4.core.util.DapException
- Throws:
dap4.core.util.DapException
-
compileAtomicVar
protected D4Cursor compileAtomicVar(dap4.core.dmr.DapVariable var, D4Cursor container) throws dap4.core.util.DapException
- Parameters:
var-container-- Returns:
- data
- Throws:
dap4.core.util.DapException
-
compileStructureArray
protected D4Cursor compileStructureArray(dap4.core.dmr.DapVariable var, D4Cursor container) throws dap4.core.util.DapException
Compile a structure array.- Parameters:
var- the templatecontainer- if inside a compound object- Returns:
- A DataCompoundArray for the databuffer for this struct.
- Throws:
dap4.core.util.DapException
-
compileStructure
protected D4Cursor compileStructure(dap4.core.dmr.DapVariable var, dap4.core.dmr.DapStructure dapstruct, D4Cursor container) throws dap4.core.util.DapException
Compile a structure instance.- Parameters:
dapstruct- The templatecontainer-- Returns:
- A DataStructure for the databuffer for this struct.
- Throws:
dap4.core.util.DapException
-
compileSequenceArray
protected D4Cursor compileSequenceArray(dap4.core.dmr.DapVariable var, D4Cursor container) throws dap4.core.util.DapException
Compile a sequence array.- Parameters:
var- the template- Returns:
- A DataCompoundArray for the databuffer for this sequence.
- Throws:
dap4.core.util.DapException
-
compileSequence
public D4Cursor compileSequence(dap4.core.dmr.DapVariable var, dap4.core.dmr.DapSequence dapseq, D4Cursor container) throws dap4.core.util.DapException
Compile a sequence as a set of records.- Parameters:
dapseq-container-- Returns:
- sequence
- Throws:
dap4.core.util.DapException
-
extractChecksum
protected int extractChecksum(ByteBuffer data) throws dap4.core.util.DapException
- Throws:
dap4.core.util.DapException
-
skip
protected static void skip(ByteBuffer data, int count)
-
getCount
protected static int getCount(ByteBuffer data)
-
getPos
protected static int getPos(ByteBuffer data)
-
computeTypeSize
protected static int computeTypeSize(dap4.core.dmr.DapType daptype)
Compute the size in databuffer of the serialized form- Parameters:
daptype-- Returns:
- type's serialized form size
-
walkByteStrings
protected static long walkByteStrings(long[] positions, ByteBuffer databuffer)
-
-