Class CompressesRasterWriter


  • public class CompressesRasterWriter
    extends Object
    Write compressed JGrass rasters to disk
    Since:
    1.1.0
    Author:
    Andrea Antonello (www.hydrologis.com)
    • Constructor Detail

      • CompressesRasterWriter

        public CompressesRasterWriter​(int _outputToDiskType,
                                      double _novalue,
                                      boolean _jump,
                                      double[] _range,
                                      long _pointerInFilePosition,
                                      long[] _rowaddresses,
                                      JGrassRegion _dataWindow,
                                      ProgressListener monitor,
                                      String mapName)
        Preparing the environment for compressing and writing the map to disk
    • Method Detail

      • compressAndWrite

        public void compressAndWrite​(ImageOutputStream theCreatedFile,
                                     ImageOutputStream theCreatedNullFile,
                                     RenderedImage renderedImage)
                              throws IOException
        Compress and write data from a map iterator.

        This method converts every single row of the buffer of values to bytes, as needed by the deflater. Then the byterows are compressed and then written to file. Every rows first byte carries the information about compression (0 = not compressed, 1 = compressed). At the begin the place for the header is written to file, in the end the header is re-written with the right rowaddresses (at the begin we do not know how much compression will influence).

        Parameters:
        theCreatedFile - - handler for the main map file
        theCreatedNullFile - - handler for the file of the null map (in cell_misc)
        Throws:
        IOException
      • isJump

        public boolean isJump()
      • getNovalue

        public double getNovalue()
      • getOutputToDiskType

        public int getOutputToDiskType()
      • getPointerInFilePosition

        public long getPointerInFilePosition()
      • getRange

        public double[] getRange()
      • getRowaddresses

        public long[] getRowaddresses()