This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: java.util.zip


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,


I just commited the attached patch to mainline to remove one more 
instance of the enum keyword usage as variable name and to to merge 
java.util.zip.InflaterInputStream more with GNU classpath.


Michael


2004-06-01  Michael Koch  <konqueror@gmx.de>

	* java/util/zip/InflaterInputStream.java: Merged more with Classpath
	version.
	* java/util/zip/ZipOutputStream.java (): Renamed enum to e to removed
	Java 1.5 keyword usage.
- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD4DBQFAu67IWSOgCCdjSDsRAiQfAJ4/zZjEYPNf+dUljMZ7J/Zg8mzadQCYpDWt
safeY3xdq7+bZlSc3C2Tbg==
=ReTT
-----END PGP SIGNATURE-----
Index: java/util/zip/InflaterInputStream.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/zip/InflaterInputStream.java,v
retrieving revision 1.18
diff -u -b -B -r1.18 InflaterInputStream.java
--- java/util/zip/InflaterInputStream.java	24 Jan 2004 20:32:57 -0000	1.18
+++ java/util/zip/InflaterInputStream.java	31 May 2004 22:14:00 -0000
@@ -1,5 +1,6 @@
 /* InflaterInputStream.java - Input stream filter for decompressing
-   Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -54,7 +55,20 @@
  */
 public class InflaterInputStream extends FilterInputStream
 {
+  /**
+   * Decompressor for this filter 
+   */
+  protected Inflater inf;
 
+  /**
+   * Byte array used as a buffer 
+   */
+  protected byte[] buf;
+
+  /**
+   * Size of buffer   
+   */
+  protected int len;
 
   protected void fill () throws IOException
   {
@@ -63,19 +77,40 @@
       inf.setInput(buf, 0, len);
   }
 
-  public InflaterInputStream (InputStream in)
+  /**
+   * Create an InflaterInputStream with the default decompresseor
+   * and a default buffer size.
+   *
+   * @param in the InputStream to read bytes from
+   */
+  public InflaterInputStream(InputStream in) 
   {
     this (in, new Inflater (), 512);
   }
 
-  public InflaterInputStream (InputStream in, Inflater infl)
+  /**
+   * Create an InflaterInputStream with the specified decompresseor
+   * and a default buffer size.
+   *
+   * @param in the InputStream to read bytes from
+   * @param inf the decompressor used to decompress data read from in
+   */
+  public InflaterInputStream(InputStream in, Inflater inf) 
   {
-    this (in, infl, 512);
+    this (in, inf, 512);
   }
 
-  public InflaterInputStream (InputStream in, Inflater inf, int size)
+  /**
+   * Create an InflaterInputStream with the specified decompresseor
+   * and a specified buffer size.
+   *
+   * @param in the InputStream to read bytes from
+   * @param inf the decompressor used to decompress data read from in
+   * @param size size of the buffer to use
+   */
+  public InflaterInputStream(InputStream in, Inflater inf, int size) 
   {
-    super (in);
+    super(in);
 
     if (in == null)
       throw new NullPointerException ("in may not be null");
@@ -79,10 +114,8 @@
 
     if (in == null)
       throw new NullPointerException ("in may not be null");
-
     if (inf == null)
       throw new NullPointerException ("inf may not be null");
-    
     if (size < 0)
       throw new IllegalArgumentException ("size may not be negative");
     
@@ -99,7 +132,15 @@
     return r;
   }
 
-  public int read (byte[] buf, int off, int len) throws IOException
+
+  /**
+   * Decompresses data into the byte array
+   *
+   * @param b the array to read and decompress data into
+   * @param off the offset indicating where the data should be placed
+   * @param len the number of bytes to decompress
+   */
+  public int read(byte[] b, int off, int len) throws IOException
   {
     if (inf == null)
       throw new IOException ("stream closed");
@@ -113,9 +154,10 @@
       {
 	if (inf.needsInput())
 	  fill ();
+	
 	try
 	  {
-	    count = inf.inflate(buf, off, len);	
+	    count = inf.inflate(b, off, len);
 	    if (count == 0)
 	      {
 		if (this.len == -1)
@@ -129,7 +171,7 @@
 	  }
 	catch (DataFormatException dfe)
 	  {
-	    throw new ZipException (dfe.getMessage());
+	    throw new ZipException(dfe.getMessage());
 	  }
       }
     return count;
@@ -150,7 +192,12 @@
     return inf.finished () ? 0 : 1;
   }
 
-  public long skip (long n) throws IOException
+  /**
+   * Skip specified number of bytes of uncompressed data
+   *
+   * @param n number of bytes to skip
+   */
+  public long skip(long n) throws IOException
   {
     if (inf == null)
       throw new IOException ("stream closed");
@@ -174,13 +221,4 @@
 
     return s;
   }
-
-  // Buffer for delivering uncompressed data to inflater.
-  protected byte[] buf;
-
-  // Inflater used to decompress data.
-  protected Inflater inf;
-
-  // Number of read bytes in buf.
-  protected int len;
 }
Index: java/util/zip/ZipOutputStream.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/zip/ZipOutputStream.java,v
retrieving revision 1.14
diff -u -b -B -r1.14 ZipOutputStream.java
--- java/util/zip/ZipOutputStream.java	17 Jun 2003 12:07:56 -0000	1.14
+++ java/util/zip/ZipOutputStream.java	31 May 2004 22:14:00 -0000
@@ -338,10 +338,10 @@
     int numEntries = 0;
     int sizeEntries = 0;
     
-    Enumeration enum = entries.elements();
-    while (enum.hasMoreElements())
+    Enumeration e = entries.elements();
+    while (e.hasMoreElements())
       {
-	ZipEntry entry = (ZipEntry) enum.nextElement();
+	ZipEntry entry = (ZipEntry) e.nextElement();
 	
 	int method = entry.getMethod();
 	writeLeInt(CENSIG);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]