You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2008/02/15 11:51:05 UTC
svn commit: r628007 -
/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java
Author: tellison
Date: Fri Feb 15 02:51:04 2008
New Revision: 628007
URL: http://svn.apache.org/viewvc?rev=628007&view=rev
Log:
JavaDoc updates.
Modified:
harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java
Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java?rev=628007&r1=628006&r2=628007&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java Fri Feb 15 02:51:04 2008
@@ -28,20 +28,28 @@
*/
public class Deflater {
+ /** Constant value representing the best available compression level. */
public static final int BEST_COMPRESSION = 9;
+ /** Constant value representing the fastest available compression level. */
public static final int BEST_SPEED = 1;
+ /** Constant value representing the default compression level. */
public static final int DEFAULT_COMPRESSION = -1;
+ /** Constant value representing the default compression strategy. */
public static final int DEFAULT_STRATEGY = 0;
+ /** Constant value representing the deflate compression strategy. */
public static final int DEFLATED = 8;
+ /** Constant value representing the filtered compression strategy. */
public static final int FILTERED = 1;
+ /** Constant value representing the Huffman compression strategy. */
public static final int HUFFMAN_ONLY = 2;
+ /** Constant value representing the no compression strategy. */
public static final int NO_COMPRESSION = 0;
private static final int Z_NO_FLUSH = 0;
@@ -112,7 +120,8 @@
throw new IllegalArgumentException();
}
compressLevel = level;
- streamHandle = createStreamWithMemoryEnsurance(compressLevel, strategy, noHeader);
+ streamHandle = createStreamWithMemoryEnsurance(compressLevel, strategy,
+ noHeader);
}
/**
@@ -186,7 +195,7 @@
* Indicates to the Deflater that all uncompressed input has been provided
* to it.
*
- * @see #finished
+ * @see #finished()
*/
public synchronized void finish() {
flushParm = Z_FINISH;
@@ -279,7 +288,7 @@
* operation <i>must</i> be called after <code>finished()</code> returns
* <code>true</code> if the <code>Deflater</code> is to be reused.
*
- * @see #finished
+ * @see #finished()
*/
public synchronized void reset() {
if (streamHandle == -1) {
@@ -294,15 +303,30 @@
private synchronized native void resetImpl(long handle);
+ /**
+ * Defines a dictionary to be used for compression by the receiver.
+ *
+ * @param buf
+ * the entire set of bytes comprising the dictionary
+ * @see #setDictionary(byte[], int, int)
+ */
public void setDictionary(byte[] buf) {
setDictionary(buf, 0, buf.length);
}
/**
* Sets the dictionary to be used for compression by this Deflater.
- * setDictionary() can only be called if this Deflater supports the writing
- * of ZLIB headers. This is the default behaviour but can be overridden
- * using Deflater(int, boolean).
+ *
+ * <code>setDictionary()</code> can only be called if this Deflater
+ * supports the writing of ZLIB headers. This is the default behaviour but
+ * can be overridden using <code>Deflater(int, boolean)</code>.
+ *
+ * @param buf
+ * the byte array containing the dictionary
+ * @param off
+ * offset into the byte array
+ * @param nbytes
+ * number of bytes comprising the dictionary
*
* @see Deflater#Deflater(int, boolean)
*/
@@ -325,6 +349,9 @@
/**
* Sets the input buffer the Deflater will use to extract uncompressed bytes
* for later compression.
+ *
+ * @param buf
+ * the input buffer
*/
public void setInput(byte[] buf) {
setInput(buf, 0, buf.length);
@@ -334,6 +361,13 @@
* Sets the input buffer the Deflater will use to extract uncompressed bytes
* for later compression. Input will be taken from the buffer region
* starting at off and ending at nbytes - 1.
+ *
+ * @param buf
+ * the input data byte array
+ * @param off
+ * offset into the input bytes
+ * @param nbytes
+ * number of valid bytes in the input array
*/
public synchronized void setInput(byte[] buf, int off, int nbytes) {
if (streamHandle == -1) {
@@ -433,9 +467,11 @@
return getTotalOutImpl(streamHandle);
}
- private long createStreamWithMemoryEnsurance(int level, int strategy1, boolean noHeader1){
+ private long createStreamWithMemoryEnsurance(int level, int strategy1,
+ boolean noHeader1) {
OSResourcesMonitor.ensurePhysicalMemoryCapacity();
return createStream(level, strategy1, noHeader1);
}
+
private native long createStream(int level, int strategy1, boolean noHeader1);
}