This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
FYI: Patch: java.io - just more merging
- From: Michael Koch <konqueror at gmx dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Fri, 28 Mar 2003 10:02:13 +0100
- Subject: FYI: Patch: java.io - just more merging
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi list,
I commited the attached path to trunk to merge java.io more with
classpath.
Michael
- --
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+hA+VWSOgCCdjSDsRAhcPAJ0YZ3ROn/cANgy4cQZf6BGdjyHhOQCfb/LH
4f7r9tSu8Pj5ZzIr0gDbmTQ=
=qyYc
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1817
diff -u -r1.1817 ChangeLog
--- ChangeLog 26 Mar 2003 22:31:52 -0000 1.1817
+++ ChangeLog 28 Mar 2003 08:59:10 -0000
@@ -1,3 +1,14 @@
+200303-28 Michael Koch <konqueror at gmx dot de>
+
+ * java/io/FileOutputStream.java:
+ Merged class documentation and authors with classpath.
+ (FileOutputStream): Partly merged with classpath.
+ (write): Merged with classpath.
+ (getChannel): Make it synchronized instead of explicit block in this
+ method.
+ * java/io/RandomAccessFile.java:
+ Merged class documentation and authors with classpath.
+
2003-03-26 Tom Tromey <tromey at redhat dot com>
* java/lang/natRuntime.cc (insertSystemProperties): Set
Index: java/io/FileOutputStream.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/FileOutputStream.java,v
retrieving revision 1.11
diff -u -r1.11 FileOutputStream.java
--- java/io/FileOutputStream.java 25 Mar 2003 13:06:52 -0000 1.11
+++ java/io/FileOutputStream.java 28 Mar 2003 08:59:10 -0000
@@ -47,8 +47,11 @@
*/
/**
+ * This classes allows a stream of data to be written to a disk file or
+ * any open <code>FileDescriptor</code>.
+ *
+ * @author Aaron M. Renn <arenn at urbanophile dot com>
* @author Tom Tromey <tromey at cygnus dot com>
- * @date September 24, 1998
*/
public class FileOutputStream extends OutputStream
{
@@ -174,9 +177,15 @@
public FileOutputStream (FileDescriptor fdObj)
throws SecurityException
{
+ // Hmm, no other exception but this one to throw, but if the descriptor
+ // isn't valid, we surely don't have "permission" to write to it.
+ if (!fdObj.valid())
+ throw new SecurityException("Invalid FileDescriptor");
+
SecurityManager s = System.getSecurityManager();
if (s != null)
s.checkWrite(fdObj);
+
fd = fdObj;
}
@@ -221,9 +230,10 @@
*
* @exception IOException If an error occurs
*/
- public void write (byte[] b) throws IOException, NullPointerException
+ public void write (byte[] buf)
+ throws IOException
{
- fd.write (b, 0, b.length);
+ fd.write (buf, 0, buf.length);
}
/**
@@ -236,12 +246,15 @@
*
* @exception IOException If an error occurs
*/
- public void write (byte[] b, int off, int len)
- throws IOException, NullPointerException, IndexOutOfBoundsException
+ public void write (byte[] buf, int offset, int len)
+ throws IOException
{
- if (off < 0 || len < 0 || off + len > b.length)
+ if (offset < 0
+ || len < 0
+ || offset + len > buf.length)
throw new ArrayIndexOutOfBoundsException ();
- fd.write (b, off, len);
+
+ fd.write (buf, offset, len);
}
/**
@@ -263,15 +276,13 @@
* A file channel must be created by first creating an instance of
* Input/Output/RandomAccessFile and invoking the getChannel() method on it.
*/
- public FileChannel getChannel ()
+ public synchronized FileChannel getChannel()
{
- synchronized (this)
- {
- if (ch == null)
- ch = new FileChannelImpl (fd, true, this);
+ if (ch == null)
+ ch = new FileChannelImpl (fd, true, this);
- return ch;
- }
+ return ch;
}
-}
+} // class FileOutputStream
+
Index: java/io/RandomAccessFile.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/RandomAccessFile.java,v
retrieving revision 1.11
diff -u -r1.11 RandomAccessFile.java
--- java/io/RandomAccessFile.java 24 Mar 2003 13:45:29 -0000 1.11
+++ java/io/RandomAccessFile.java 28 Mar 2003 08:59:10 -0000
@@ -41,16 +41,22 @@
import java.nio.channels.FileChannel;
import gnu.java.nio.FileChannelImpl;
-/**
- * @author Tom Tromey <tromey at cygnus dot com>
- * @date September 25, 1998
- */
-
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
* Status: Believe complete and correct to 1.1.
*/
+/**
+ * This class allows reading and writing of files at random locations.
+ * Most Java I/O classes are either pure sequential input or output. This
+ * class fulfills the need to be able to read the bytes of a file in an
+ * arbitrary order. In addition, this class implements the
+ * <code>DataInput</code> and <code>DataOutput</code> interfaces to allow
+ * the reading and writing of Java primitives.
+ *
+ * @author Aaron M. Renn <arenn at urbanophile dot com>
+ * @author Tom Tromey <tromey at cygnus dot com>
+ */
public class RandomAccessFile implements DataOutput, DataInput
{