Package dap4.dap4lib

Class D4DataCompiler


  • public class D4DataCompiler
    extends Object
    • Method Detail

      • compile

        public void compile()
                     throws IOException
        The goal here is to process the serialized databuffer and pull out top-level variable positions in the serialized databuffer. In some cases -- String, Sequence, Structure -- significant transforms are applied to the data to make it usable with ucar.ma2.Array.
        Throws:
        DapException
        IOException
      • compileVar

        protected Object compileVar​(DapVariable dapvar)
                             throws IOException
        Return a compiled version of the data for this variable. Possible return values are: 1. String - String[] 2. Opaque - Bytebuffer[] 3. Fixed atomic - [] 4. Structure - Object[][nfields] 5. Sequence - Object[][nfields]
        Throws:
        IOException
      • compileStructureArray

        protected Object compileStructureArray​(DapVariable var)
                                        throws IOException
        Compile a structure array. Since we are using ArrayStructureMA, we need to capture Our storage is Object[dimproduct]; this will be converted properly when the D4Cursor Array is created.
        Parameters:
        var - the template
        Returns:
        a StructureData[dimproduct] for the data for this struct.
        Throws:
        DapException
        IOException
      • compileStructure

        protected Object compileStructure​(DapStructure dapstruct)
                                   throws IOException
        Compile a structure instance. Storage is Object[dapstruct.getFields().size()];
        Parameters:
        dapstruct - The template
        Returns:
        A DataStructure for the databuffer for this struct.
        Throws:
        DapException
        IOException
      • compileSequenceArray

        protected Object compileSequenceArray​(DapVariable var)
                                       throws IOException
        Compile a sequence array. Our storage is Object[dimproduct]
        Parameters:
        var - the template
        Returns:
        Object[recordcount]
        Throws:
        DapException
        IOException
      • compileSequence

        public Object compileSequence​(DapSequence dapseq)
                               throws IOException
        Compile a sequence as a set of records. Our storage is Object[] where |storage| == nrecords
        Parameters:
        dapseq -
        Returns:
        sequence
        Throws:
        DapException
        IOException
      • computeTypeSize

        protected int computeTypeSize​(DapType daptype)
        Compute the size in databuffer of the serialized form
        Parameters:
        daptype -
        Returns:
        type's serialized form size
      • createSequenceArray

        protected Array createSequenceArray​(DapVariable var,
                                            Object storage)
        Create an Array object for a DAP4 Sequence. Unfortunately, the whole CDM Sequence/VLEN mechanism is completely hosed, with no hope of a simple fix. It appears that the only thing we can do is support scalar sequences. However in useless hope, the code is written as if arrays of sequences can be supported.
        Parameters:
        var -
        storage -
        Returns: