Package org.dict.zip

Class DictZipInputStream

    • Constructor Detail

      • DictZipInputStream

        public DictZipInputStream​(String filename)
                           throws IOException
        Creates a new input stream with a default buffer size from given filepath.
        Parameters:
        filename - the input filename
        Throws:
        IOException - if an I/O error has occurred
      • DictZipInputStream

        public DictZipInputStream​(RandomAccessInputStream in)
                           throws IOException
        Creates a new input stream with a default buffer size.
        Parameters:
        in - the input stream
        Throws:
        IOException - if an I/O error has occurred
      • DictZipInputStream

        public DictZipInputStream​(RandomAccessInputStream in,
                                  int size)
                           throws IOException
        Creates a new input stream with the specified buffer size.
        Parameters:
        in - the input stream
        size - the input buffer size
        Throws:
        IOException - if an I/O error has occurred
    • Method Detail

      • read

        public final int read​(byte[] buffer,
                              int off,
                              int size)
                       throws IOException
        Reads uncompressed data into an array of bytes. Blocks until enough input is available for decompression.
        Overrides:
        read in class InflaterInputStream
        Parameters:
        buffer - the buffer into which the data is read
        off - the start offset of the data
        size - the maximum number of bytes read
        Returns:
        the actual number of bytes read, or -1 if the end of the compressed input stream is reached
        Throws:
        IOException - if an I/O error has occurred or the compressed input data is corrupt
      • readFully

        public final void readFully​(byte[] buffer)
                             throws IOException
        Read full data.
        Parameters:
        buffer - the buffer into which the data is read
        Throws:
        IOException - if an I/O error has occurred or the compressed input data is corrupt
      • readFully

        public final void readFully​(byte[] buffer,
                                    int off,
                                    int size)
                             throws IOException
        Read full data by offset/length.
        Parameters:
        buffer - the buffer into which the data is read
        off - offset
        size - length
        Throws:
        IOException - if an I/O error has occurred or the compressed input data is corrupt
      • seek

        public void seek​(long next)
                  throws IOException
        Seek to a raw index next.
        Parameters:
        next - a raw index
        Throws:
        IOException - when instance is not a RandomAccessInputStream.
      • getCrc

        public long getCrc()
                    throws IOException
        Return CRC value set to gzip trailer.
        Returns:
        CRC value.
        Throws:
        IOException - if I/O error.
      • getLength

        public long getLength()
                       throws IOException
        Return length value set to gzip trailer.
        Returns:
        data length.
        Throws:
        IOException - if I/O error.
      • getCompLength

        public long getCompLength()
                           throws IOException
        Get total length of compressed data.
        Returns:
        total length
        Throws:
        IOException - when I/O error at trailer reading.
      • getType

        public String getType()
                       throws IOException
        Get type of compression.
        Returns:
        "DZIP" or "GZIP"
        Throws:
        IOException - if I/O error occurred.
      • getChunkLength

        public int getChunkLength()
                           throws IOException
        Get length of each chunk.
        Returns:
        size of chunk.
        Throws:
        IOException - if I/O error occurred.
      • getChunkCount

        public int getChunkCount()
                          throws IOException
        Get number of chunks.
        Returns:
        number of chunks.
        Throws:
        IOException - if I/O error occurred.
      • getMtime

        public long getMtime()
                      throws IOException
        Get mtime in long.
        Returns:
        mtime in long.
        Throws:
        IOException - if I/O error occurred.
      • getFilename

        public String getFilename()
                           throws IOException
        Get Filename field if exist.
        Returns:
        filename or null.
        Throws:
        IOException - if I/O error occurred.