@Override protected void loadUncompressedRaster( final RAWImageInputStream iis, final WritableRaster raster, final RAWImageReaderSupport ir) throws IOException { final DataBufferUShort dataBuffer = (DataBufferUShort) raster.getDataBuffer(); final short[] data = dataBuffer.getData(); final int width = raster.getWidth(); final int height = raster.getHeight(); final int pixelStride = 1; final int scanStride = width * pixelStride; setBitsPerSample(12); selectBitReader(iis, raster, 12); // // We can rely on the fact that the array has been zeroed by the JVM, so we just set nonzero // samples. // for (int y = 0; y < height; y++) { final int row = getRow(y, height); int i = row * scanStride; for (int x = 0; x < width; x++) { int sample = (int) iis.readBits(12); data[i] = (short) sample; endOfColumn(x, iis); i += pixelStride; } ir.processImageProgress((100.0f * y) / height); endOfRow(y, iis); } }