private Array decodeVlenData ( NcStreamProto . DataCol dproto , Section parentSection ) throws IOException { DataType dataType = NcStream . convertDataType ( dproto . getDataType ( ) ) ; ByteBuffer bb = dproto . getPrimdata ( ) . asReadOnlyByteBuffer ( ) ; ByteOrder bo = dproto . getBigend ( ) ? ByteOrder . BIG_ENDIAN : ByteOrder . LITTLE_ENDIAN ; bb . order ( bo ) ; Array alldata = Array . factory ( dataType , new int [ ] { dproto . getNelems ( ) } , bb ) ; // 1D array IndexIterator all = alldata . getIndexIterator ( ) ; int psize = ( int ) parentSection . computeSize ( ) ; Section section = NcStream . decodeSection ( dproto . getSection ( ) ) ; Section vsection = section . removeFirst ( parentSection ) ; int vsectionSize = ( int ) vsection . computeSize ( ) ; // the # of varlen Arrays at the inner structure // LOOK check for scalar // divide the primitive data into variable length arrays int countInner = 0 ; Array [ ] pdata = new Array [ psize ] ; for ( int pCount = 0 ; pCount < psize ; pCount ++ ) { Array [ ] vdata = new Array [ vsectionSize ] ; for ( int vCount = 0 ; vCount < vsectionSize ; vCount ++ ) { int vlen = dproto . getVlens ( countInner ++ ) ; Array primdata = Array . factory ( dataType , new int [ ] { vlen } ) ; IndexIterator prim = primdata . getIndexIterator ( ) ; for ( int i = 0 ; i < vlen ; i ++ ) { prim . setObjectNext ( all . getObjectNext ( ) ) ; // generic } vdata [ vCount ] = primdata ; } pdata [ pCount ] = Array . makeVlenArray ( vsection . getShape ( ) , vdata ) ; } // ArrayObject(parentShape) return Array . makeVlenArray ( parentSection . getShape ( ) , pdata ) ; }
vlen inside a Structure