cdm/src/main/java/ucar/nc2/iosp/IospHelper.java
static public Object readDataFill(LayoutBB layout, DataType dataType, Object fillValue) throws java.io.IOException {
    long size = layout.getTotalNelems();
    if (dataType == DataType.STRUCTURE) size *= layout.getElemSize();
    Object arr = (fillValue == null) ? makePrimitiveArray((int) size, dataType) :
            makePrimitiveArray((int) size, dataType, fillValue);
    return readData(layout, dataType, arr);
  }
static public Object readDataFill(LayoutBB layout, DataType dataType, Object fillValue) throws java.io.IOException {
    long size = layout.getTotalNelems();
    if (dataType == DataType.STRUCTURE) size *= layout.getElemSize();
    Object arr = (fillValue == null) ? makePrimitiveArray((int) size, dataType) :
            makePrimitiveArray((int) size, dataType, fillValue);
    return readData(layout, dataType, arr);
  }
static public Object readDataFill ( LayoutBB layout , DataType dataType , Object fillValue ) throws java . io . IOException { long size = layout . getTotalNelems ( ) ; if ( dataType == DataType . STRUCTURE ) size *= layout . getElemSize ( ) ; Object arr = ( fillValue == null ) ? makePrimitiveArray ( ( int ) size , dataType ) : makePrimitiveArray ( ( int ) size , dataType , fillValue ) ; return readData ( layout , dataType , arr ) ; }
Read data subset from ByteBuffer, create primitive array of size Layout.getTotalNelems.
Reading is controlled by the Layout object.

@param layout    handles skipping around in the file, provide ByteBuffer to read from
@param dataType  dataType of the variable
@param fillValue must be Number if dataType.isNumeric(), or String for STRING, byte[] for Structure, or null for none
@return primitive array with data read in
@throws java.io.IOException on read error
Read data subset from ByteBuffer create primitive array of size Layout . getTotalNelems . Reading is controlled by the Layout object .