public Array readCompressedData(ucar.nc2.Variable v2, long dataPos, int[] origin, int[] shape, int[] stride) throws IOException, InvalidRangeException {

    long length = raf.length();

    raf.seek(dataPos);

    int data_size = (int) (length - dataPos);
    byte[] data = new byte[data_size];
    raf.readFully(data);
    ByteArrayInputStream ios = new ByteArrayInputStream(data);

    BufferedImage image = javax.imageio.ImageIO.read(ios);
    Raster raster = image.getData();
    DataBuffer db = raster.getDataBuffer();

    if (db instanceof DataBufferByte) {
      DataBufferByte dbb = (DataBufferByte) db;
      byte[] udata = dbb.getData();

      Array array = Array.factory(DataType.BYTE, v2.getShape(), udata);
      v2.setCachedData(array, false);
      return array.sectionNoReduce(origin, shape, stride);
    }

    return null;
  }
public Array readCompressedData ( ucar . nc2 . Variable v2 , long dataPos , int [ ] origin , int [ ] shape , int [ ] stride ) throws IOException , InvalidRangeException { long length = raf . length ( ) ; raf . seek ( dataPos ) ; int data_size = ( int ) ( length - dataPos ) ; byte [ ] data = new byte [ data_size ] ; raf . readFully ( data ) ; ByteArrayInputStream ios = new ByteArrayInputStream ( data ) ; BufferedImage image = javax . imageio . ImageIO . read ( ios ) ; Raster raster = image . getData ( ) ; DataBuffer db = raster . getDataBuffer ( ) ; if ( db instanceof DataBufferByte ) { DataBufferByte dbb = ( DataBufferByte ) db ; byte [ ] udata = dbb . getData ( ) ; Array array = Array . factory ( DataType . BYTE , v2 . getShape ( ) , udata ) ; v2 . setCachedData ( array , false ) ; return array . sectionNoReduce ( origin , shape , stride ) ; } return null ; }
for the compressed data read all out into a array and then parse into requested