/** * Resets this {@code Inflater}. Should be called prior to inflating a new * set of data. */ public synchronized void reset() { checkOpen(); finished = false; needsDictionary = false; inLength = inRead = 0; resetImpl(streamHandle); }
/** * Returns the total number of bytes of input read by this {@code Inflater}. This * method is limited to 32 bits; use {@link #getBytesRead} instead. */ public synchronized int getTotalIn() { checkOpen(); return (int) Math.min(getTotalInImpl(streamHandle), (long) Integer.MAX_VALUE); }
synchronized int setFileInput(FileDescriptor fd, long offset, int byteCount) { checkOpen(); inRead = 0; inLength = setFileInputImpl(fd, offset, byteCount, streamHandle); return inLength; }
/** * Returns the total number of bytes written to the output buffer by this {@code * Inflater}. The method is limited to 32 bits; use {@link #getBytesWritten} instead. */ public synchronized int getTotalOut() { checkOpen(); return (int) Math.min(getTotalOutImpl(streamHandle), (long) Integer.MAX_VALUE); }
/** * Returns the {@link Adler32} checksum of the bytes inflated so far, or the * checksum of the preset dictionary if {@link #needsDictionary} returns true. */ public synchronized int getAdler() { checkOpen(); return getAdlerImpl(streamHandle); }
/** * Returns the total number of bytes read by the {@code Inflater}. This * method is the same as {@link #getTotalIn} except that it returns a * {@code long} value instead of an integer. */ public synchronized long getBytesRead() { checkOpen(); return getTotalInImpl(streamHandle); }
/** * Returns a the total number of bytes written by this {@code Inflater}. This * method is the same as {@code getTotalOut} except it returns a * {@code long} value instead of an integer. */ public synchronized long getBytesWritten() { checkOpen(); return getTotalOutImpl(streamHandle); }
/** * Sets the preset dictionary to be used for inflation to a subsequence of {@code dictionary} * starting at {@code offset} and continuing for {@code byteCount} bytes. See {@link * #needsDictionary} for details. */ public synchronized void setDictionary(byte[] dictionary, int offset, int byteCount) { checkOpen(); Arrays.checkOffsetAndCount(dictionary.length, offset, byteCount); setDictionaryImpl(dictionary, offset, byteCount, streamHandle); }
/** * Sets the current input to to be decompressed. This method should only be * called if {@link #needsInput} returns {@code true}. */ public synchronized void setInput(byte[] buf, int offset, int byteCount) { checkOpen(); Arrays.checkOffsetAndCount(buf.length, offset, byteCount); inRead = 0; inLength = byteCount; setInputImpl(buf, offset, byteCount, streamHandle); }
/** * Inflates up to {@code byteCount} bytes from the current input and stores them in * {@code buf} starting at {@code offset}. * * @throws DataFormatException * if the underlying stream is corrupted or was not compressed * using a {@code Deflater}. * @return the number of bytes inflated. */ public synchronized int inflate(byte[] buf, int offset, int byteCount) throws DataFormatException { Arrays.checkOffsetAndCount(buf.length, offset, byteCount); checkOpen(); if (needsInput()) { return 0; } boolean neededDict = needsDictionary; needsDictionary = false; int result = inflateImpl(buf, offset, byteCount, streamHandle); if (needsDictionary && neededDict) { throw new DataFormatException("Needs dictionary"); } return result; }
/** * Returns the {@link Adler32} checksum of the bytes inflated so far, or the * checksum of the preset dictionary if {@link #needsDictionary} returns true. */ public synchronized int getAdler() { checkOpen(); return getAdlerImpl(streamHandle); }
/** * Returns the total number of bytes read by the {@code Inflater}. This * method is the same as {@link #getTotalIn} except that it returns a * {@code long} value instead of an integer. */ public synchronized long getBytesRead() { checkOpen(); return getTotalInImpl(streamHandle); }
/** * Returns the total number of bytes written to the output buffer by this {@code * Inflater}. The method is limited to 32 bits; use {@link #getBytesWritten} instead. */ public synchronized int getTotalOut() { checkOpen(); return (int) Math.min(getTotalOutImpl(streamHandle), (long) Integer.MAX_VALUE); }
/** * Resets this {@code Inflater}. Should be called prior to inflating a new * set of data. */ public synchronized void reset() { checkOpen(); finished = false; needsDictionary = false; inLength = inRead = 0; resetImpl(streamHandle); }
/** * Returns the total number of bytes read by the {@code Inflater}. This * method is the same as {@link #getTotalIn} except that it returns a * {@code long} value instead of an integer. */ public synchronized long getBytesRead() { checkOpen(); return getTotalInImpl(streamHandle); }
/** * Returns the total number of bytes of input read by this {@code Inflater}. This * method is limited to 32 bits; use {@link #getBytesRead} instead. */ public synchronized int getTotalIn() { checkOpen(); return (int) Math.min(getTotalInImpl(streamHandle), (long) Integer.MAX_VALUE); }
/** * Resets this {@code Inflater}. Should be called prior to inflating a new * set of data. */ public synchronized void reset() { checkOpen(); finished = false; needsDictionary = false; inLength = inRead = 0; resetImpl(streamHandle); }
synchronized int setFileInput(FileDescriptor fd, long offset, int byteCount) { checkOpen(); inRead = 0; inLength = setFileInputImpl(fd, offset, byteCount, streamHandle); return inLength; }
synchronized int setFileInput(FileDescriptor fd, long offset, int byteCount) { checkOpen(); inRead = 0; inLength = setFileInputImpl(fd, offset, byteCount, streamHandle); return inLength; }
/** * Sets the preset dictionary to be used for inflation to a subsequence of {@code dictionary} * starting at {@code offset} and continuing for {@code byteCount} bytes. See {@link * #needsDictionary} for details. */ public synchronized void setDictionary(byte[] dictionary, int offset, int byteCount) { checkOpen(); Arrays.checkOffsetAndCount(dictionary.length, offset, byteCount); setDictionaryImpl(dictionary, offset, byteCount, streamHandle); }