clcommon/src/main/java/ucar/nc2/iosp/gini/Giniiosp.java
private Array readCompressedData(ucar.nc2.Variable v2, long dataPos, List<Range> ranges,
                                   int[] levels) throws IOException, InvalidRangeException {
    // Get to the proper offset and read in the rest of the compressed data
    raf.seek(dataPos);
    int data_size = (int) (raf.length() - dataPos);
    byte[] data = new byte[data_size];
    raf.readFully(data);

    // Send the compressed data to ImageIO (to handle PNG)
    ByteArrayInputStream ios = new ByteArrayInputStream(data);
    BufferedImage image = javax.imageio.ImageIO.read(ios); // LOOK why ImageIO ??
    DataBuffer db = image.getData().getDataBuffer();

    // If the image had byte data, turn into an array
    if (db instanceof DataBufferByte) {
      DataBufferByte dbb = (DataBufferByte) db;
      Array array = makeArray(dbb.getData(), levels, v2.getShape());
      if (levels == null)
        v2.setCachedData(array, false);
      return array.sectionNoReduce(ranges);
    }

    return null;
  }
private Array readCompressedData(ucar.nc2.Variable v2, long dataPos, List<Range> ranges,
                                   int[] levels) throws IOException, InvalidRangeException {
    // Get to the proper offset and read in the rest of the compressed data
    raf.seek(dataPos);
    int data_size = (int) (raf.length() - dataPos);
    byte[] data = new byte[data_size];
    raf.readFully(data);

    // Send the compressed data to ImageIO (to handle PNG)
    ByteArrayInputStream ios = new ByteArrayInputStream(data);
    BufferedImage image = javax.imageio.ImageIO.read(ios); // LOOK why ImageIO ??
    DataBuffer db = image.getData().getDataBuffer();

    // If the image had byte data, turn into an array
    if (db instanceof DataBufferByte) {
      DataBufferByte dbb = (DataBufferByte) db;
      Array array = makeArray(dbb.getData(), levels, v2.getShape());
      if (levels == null)
        v2.setCachedData(array, false);
      return array.sectionNoReduce(ranges);
    }

    return null;
  }
for the compressed data read all out into a array and then parse into requested