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]

FYI: Patch: java.io - more merging


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

Hi list,


I commited another little patch to trunk to merge java.io with 
classpath more and more.


Michael
- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+hEmCWSOgCCdjSDsRAqGzAKCdG8zZxeHiLZy03o0TCz5RiFSmqwCfeEwk
UVLL2mq9csdRydEz6FuX4rs=
=67/O
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1819
diff -u -r1.1819 ChangeLog
--- ChangeLog	28 Mar 2003 09:49:29 -0000	1.1819
+++ ChangeLog	28 Mar 2003 13:06:29 -0000
@@ -1,5 +1,19 @@
 2003-03-28  Michael Koch  <konqueror at gmx dot de>
 
+	* java/io/File.java:
+	Import needed classes instead of whole packages, merged class
+	documentation with classpath, moved constants and variables to top of
+	class.
+	* java/io/PrintStream.java:
+	Merged class documentation with classpath, moved constants and
+	variables to top of class.
+	* java/io/RandomAccessFile.java
+	(RandomAccessFile): Merged with classpath.
+	(read): Merged with classpath).
+	(read*): Reformatted.
+
+2003-03-28  Michael Koch  <konqueror at gmx dot de>
+
 	* java/io/FileDescriptor.java
 	(finalize): Throws Throwable, not IOException.
 	* java/io/ObjectOutputStream.java
Index: java/io/File.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/File.java,v
retrieving revision 1.29
diff -u -r1.29 File.java
--- java/io/File.java	24 Mar 2003 15:43:22 -0000	1.29
+++ java/io/File.java	28 Mar 2003 13:06:30 -0000
@@ -38,22 +38,49 @@
 
 package java.io;
 
-import java.util.*;
-import java.net.*;
+import java.net.MalformedURLException;
+import java.net.URL;
 import gnu.gcj.runtime.FileDeleter;
 
-/**
- * @author Tom Tromey <tromey at cygnus dot com>
- * @date September 24, 1998 
- */
-
 /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
  * "The Java Language Specification", ISBN 0-201-63451-1
  * Status:  Complete to version 1.3.
  */
 
+/**
+ * This class represents a file or directory on a local disk.  It provides
+ * facilities for dealing with a variety of systems that use various
+ * types of path separators ("/" versus "\", for example).  It also
+ * contains method useful for creating and deleting files and directories.
+ *
+ * @author Aaron M. Renn <arenn at urbanophile dot com>
+ * @author Tom Tromey <tromey at cygnus dot com>
+ */
 public class File implements Serializable, Comparable
 {
+  private static final long serialVersionUID = 301077366599181567L;
+	
+  // QUERY arguments to access function.
+  private final static int READ = 0;
+  private final static int WRITE = 1;
+  private final static int EXISTS = 2;
+
+  // QUERY arguments to stat function.
+  private final static int DIRECTORY = 0;
+  private final static int ISFILE = 1;
+  private final static int ISHIDDEN = 2;
+
+  // QUERY arguments to attr function.
+  private final static int MODIFIED = 0;
+  private final static int LENGTH = 1;
+  
+  private final native long attr (int query);
+  // On OSF1 V5.0, `stat' is a macro.  It is easiest to use the name
+  // `_stat' instead.  We do the same thing for `_access' just in
+  // case.
+  private final native boolean _access (int query);
+  private final native boolean _stat (int query);
+
   public boolean canRead ()
   {
     checkRead();
@@ -612,26 +639,4 @@
       path = path.replace (oldSeparatorChar, separatorChar);
   }
 
-  // QUERY arguments to access function.
-  private final static int READ = 0;
-  private final static int WRITE = 1;
-  private final static int EXISTS = 2;
-
-  // QUERY arguments to stat function.
-  private final static int DIRECTORY = 0;
-  private final static int ISFILE = 1;
-  private final static int ISHIDDEN = 2;
-
-  // QUERY arguments to attr function.
-  private final static int MODIFIED = 0;
-  private final static int LENGTH = 1;
-  
-  private final native long attr (int query);
-  // On OSF1 V5.0, `stat' is a macro.  It is easiest to use the name
-  // `_stat' instead.  We do the same thing for `_access' just in
-  // case.
-  private final native boolean _access (int query);
-  private final native boolean _stat (int query);
-
-  private static final long serialVersionUID = 301077366599181567L;
 }
Index: java/io/PrintStream.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/PrintStream.java,v
retrieving revision 1.13
diff -u -r1.13 PrintStream.java
--- java/io/PrintStream.java	24 Mar 2003 15:43:22 -0000	1.13
+++ java/io/PrintStream.java	28 Mar 2003 13:06:30 -0000
@@ -37,24 +37,55 @@
 
 
 package java.io;
-import gnu.gcj.convert.UnicodeToBytes;
 
-/**
- * @author Tom Tromey <tromey at cygnus dot com>
- * @date September 24, 1998 
- */
+import gnu.gcj.convert.UnicodeToBytes;
 
 /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
  * "The Java Language Specification", ISBN 0-201-63451-1
  * Status:  Believed complete and correct to 1.3
  */
 
+/**
+ * This class prints Java primitive values and object to a stream as
+ * text.  None of the methods in this class throw an exception.  However,
+ * errors can be detected by calling the <code>checkError()</code> method.
+ * Additionally, this stream can be designated as "autoflush" when 
+ * created so that any writes are automatically flushed to the underlying
+ * output sink when the current line is terminated.
+ * <p>
+ * <b>Note that this class is deprecated</b>.  It exists for backward  
+ * compatibility only.  New code should be written to use 
+ * <code>PrintWriter</code> instead.  
+ * <p>
+ * This class converts char's into byte's using the system default encoding.
+ *
+ * @deprecated
+ *
+ * @author Aaron M. Renn <arenn at urbanophile dot com>
+ * @author Tom Tromey <tromey at cygnus dot com>
+ */
 public class PrintStream extends FilterOutputStream
 {
   /* Notice the implementation is quite similar to OutputStreamWriter.
    * This leads to some minor duplication, because neither inherits
    * from the other, and we want to maximize performance. */
 
+  // Line separator string.
+  private static final char[] line_separator
+    = System.getProperty("line.separator").toCharArray();
+  
+  UnicodeToBytes converter;
+
+  // Work buffer of characters for converter.
+  char[] work = new char[100];
+  // Work buffer of bytes where we temporarily keep converter output.
+  byte[] work_bytes = new byte[100];
+
+  // True if error occurred.
+  private boolean error;
+  // True if auto-flush.
+  private boolean auto_flush;
+
   public PrintStream (OutputStream out)
   {
     this(out, false);
@@ -312,19 +343,4 @@
       }
   }
 
-  UnicodeToBytes converter;
-
-  // Work buffer of characters for converter.
-  char[] work = new char[100];
-  // Work buffer of bytes where we temporarily keep converter output.
-  byte[] work_bytes = new byte[100];
-
-  // True if error occurred.
-  private boolean error;
-  // True if auto-flush.
-  private boolean auto_flush;
-
-  // Line separator string.
-  private static final char[] line_separator
-    = System.getProperty("line.separator").toCharArray();
 }
Index: java/io/RandomAccessFile.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/RandomAccessFile.java,v
retrieving revision 1.12
diff -u -r1.12 RandomAccessFile.java
--- java/io/RandomAccessFile.java	28 Mar 2003 08:59:41 -0000	1.12
+++ java/io/RandomAccessFile.java	28 Mar 2003 13:06:30 -0000
@@ -87,7 +87,8 @@
    * is not allowed
    * @exception IOException If any other error occurs
    */
-  public RandomAccessFile (File file, String mode) throws FileNotFoundException
+  public RandomAccessFile (File file, String mode)
+    throws FileNotFoundException
   {
     this (file.getPath(), mode);
   }
@@ -102,7 +103,7 @@
    * opening the file to determine whether or not this file is allowed to
    * be read or written.
    *
-   * @param name The name of the file to read and/or write
+   * @param fileName The name of the file to read and/or write
    * @param mode "r" for read only or "rw" for read-write access to the file
    *
    * @exception IllegalArgumentException If <code>mode</code> has an 
@@ -114,6 +115,11 @@
   public RandomAccessFile (String fileName, String mode)
     throws FileNotFoundException
   {
+    // Check the mode
+    if (!mode.equals("r") && !mode.equals("rw") && !mode.equals("rws") &&
+        !mode.equals("rwd"))
+      throw new IllegalArgumentException("Bad mode value: " + mode);
+  
     int fdmode;
     if (mode.compareTo ("r") == 0)
       fdmode = FileDescriptor.READ;
@@ -122,12 +128,14 @@
     else
       throw new IllegalArgumentException ("invalid mode: " + mode);
 
+    // The obligatory SecurityManager stuff
     SecurityManager s = System.getSecurityManager();
     if (s != null)
       {
-	s.checkRead(fileName);
-	if ((fdmode & FileDescriptor.WRITE) != 0)
-	  s.checkWrite(fileName);
+        s.checkRead(fileName);
+
+        if ((fdmode & FileDescriptor.WRITE) != 0)
+          s.checkWrite(fileName);
       }
 
     fd = new FileDescriptor (fileName, fdmode);
@@ -159,6 +167,7 @@
   {
     if (! fd.valid())
       throw new IOException ();
+
     return fd;
   }
 
@@ -231,12 +240,12 @@
    */
   public int read (byte[] buffer) throws IOException
   {
-    return in.read(buffer);
+    return in.read (buffer);
   }
 
   /**
-   * This methods reads up to <code>len</code> bytes from the file into the s
-   * pecified array starting at position <code>offset</code> into the array.
+   * This methods reads up to <code>len</code> bytes from the file into the
+   * specified array starting at position <code>offset</code> into the array.
    *
    * @param buf The array to read the bytes into
    * @param offset The index into the array to start storing bytes
@@ -246,9 +255,9 @@
    *
    * @exception IOException If an error occurs
    */
-  public int read (byte[] buffer, int offset, int count) throws IOException
+  public int read (byte[] buffer, int offset, int len) throws IOException
   {
-    return in.read(buffer, offset, count);
+    return in.read (buffer, offset, len);
   }
 
   /**
@@ -270,7 +279,7 @@
    */
   public final boolean readBoolean () throws IOException
   {
-    return in.readBoolean();
+    return in.readBoolean ();
   }
 
   /**
@@ -290,7 +299,7 @@
    */
   public final byte readByte () throws IOException
   {
-    return in.readByte();
+    return in.readByte ();
   }
 
   /**
@@ -347,7 +356,7 @@
    */
   public final double readDouble () throws IOException
   {
-    return in.readDouble();
+    return in.readDouble ();
   }
 
   /**
@@ -412,7 +421,7 @@
   public final void readFully (byte[] buffer, int offset, int count)
     throws IOException
   {
-    in.readFully(buffer, offset, count);
+    in.readFully (buffer, offset, count);
   }
 
   /**
@@ -477,7 +486,7 @@
    */
   public final String readLine () throws IOException
   {
-    return in.readLine();
+    return in.readLine ();
   }
 
   /**

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