aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2001-10-01 18:24:54 +0000
committerMark Wielaard <mark@gcc.gnu.org>2001-10-01 18:24:54 +0000
commit477946a63dee474c725243ae0d998f4cba1bfc0a (patch)
tree4dda11c70f74fbaee3eeeac3ddfd3597c909ea23 /libjava
parentbe55d07d6f4666c031950dc610bdb3fe85c007b5 (diff)
downloadgcc-477946a63dee474c725243ae0d998f4cba1bfc0a.zip
gcc-477946a63dee474c725243ae0d998f4cba1bfc0a.tar.gz
gcc-477946a63dee474c725243ae0d998f4cba1bfc0a.tar.bz2
FileWriter.java: Merge with Classpath.
* java/io/FileWriter.java: Merge with Classpath. * java/io/FilterInputStream.java: Ditto. (mark): no longer synchronized (reset): Likewise * java/io/FilterOutputStream.java: Merge with Classpath. * java/io/FilterReader.java: Ditto. (mark): no longer synchronized (reset): Likewise * java/io/FilterWriter.java: Merge with Classpath. * java/io/Writer.java: Ditto. * java/lang/Compiler.java: Ditto. * java/lang/Process.java: Ditto. * java/lang/Void.java: Ditto. * java/net/ContentHandler.java: Ditto. * java/net/DatagramPacket.java: Ditto. * java/net/MulticastSocket.java: Merge comments with Classpath. From-SVN: r45930
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog19
-rw-r--r--libjava/java/io/FileWriter.java142
-rw-r--r--libjava/java/io/FilterInputStream.java286
-rw-r--r--libjava/java/io/FilterOutputStream.java205
-rw-r--r--libjava/java/io/FilterReader.java263
-rw-r--r--libjava/java/io/FilterWriter.java198
-rw-r--r--libjava/java/io/Writer.java250
-rw-r--r--libjava/java/lang/Compiler.java118
-rw-r--r--libjava/java/lang/Process.java110
-rw-r--r--libjava/java/lang/Void.java60
-rw-r--r--libjava/java/net/ContentHandler.java77
-rw-r--r--libjava/java/net/DatagramPacket.java189
-rw-r--r--libjava/java/net/MulticastSocket.java156
13 files changed, 1660 insertions, 413 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index bebc677..c7e3a57 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,22 @@
+2001-10-01 Mark Wielaard <mark@klomp.org>
+
+ * java/io/FileWriter.java: Merge with Classpath.
+ * java/io/FilterInputStream.java: Ditto.
+ (mark): no longer synchronized
+ (reset): Likewise
+ * java/io/FilterOutputStream.java: Merge with Classpath.
+ * java/io/FilterReader.java: Ditto.
+ (mark): no longer synchronized
+ (reset): Likewise
+ * java/io/FilterWriter.java: Merge with Classpath.
+ * java/io/Writer.java: Ditto.
+ * java/lang/Compiler.java: Ditto.
+ * java/lang/Process.java: Ditto.
+ * java/lang/Void.java: Ditto.
+ * java/net/ContentHandler.java: Ditto.
+ * java/net/DatagramPacket.java: Ditto.
+ * java/net/MulticastSocket.java: Merge comments with Classpath.
+
2001-09-30 Mark Wielaard <mark@klomp.org>
* java/io/DataInput.java: Merge with Classpath.
diff --git a/libjava/java/io/FileWriter.java b/libjava/java/io/FileWriter.java
index 5c49e5f..53e3658 100644
--- a/libjava/java/io/FileWriter.java
+++ b/libjava/java/io/FileWriter.java
@@ -1,44 +1,126 @@
-// FileWriter.java - Character output to a file.
+/* FileWriter.java -- Convenience class for writing to files.
+ Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
-/* Copyright (C) 1998, 1999 Free Software Foundation
+This file is part of GNU Classpath.
- This file is part of libgcj.
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
-package java.io;
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-/**
- * @author Tom Tromey <tromey@cygnus.com>
- * @date September 25, 1998
- */
+
+package java.io;
/* 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.1.
*/
+/**
+ * This is a convenience class for writing to files. It creates an
+ * <code>FileOutputStream</code> and initializes an
+ * <code>OutputStreamWriter</code> to write to it.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey <tromey@cygnus.com>
+ */
public class FileWriter extends OutputStreamWriter
{
- public FileWriter (String fileName) throws IOException
- {
- super (new FileOutputStream (fileName));
- }
-
- public FileWriter (String fileName, boolean append) throws IOException
- {
- super (new FileOutputStream (fileName, append));
- }
-
- public FileWriter (File file) throws IOException
- {
- super (new FileOutputStream (file));
- }
-
- public FileWriter (FileDescriptor fd)
- {
- super (new FileOutputStream (fd));
- }
+
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+/**
+ * This method initializes a new <code>FileWriter</code> object to write
+ * to the specified <code>File</code> object.
+ *
+ * @param file The <code>File</code> object to write to.
+ *
+ * @param SecurityException If writing to this file is forbidden by the
+ * <code>SecurityManager</code>.
+ * @param IOException If any other error occurs
+ */
+public
+FileWriter(File file) throws SecurityException, IOException
+{
+ super(new FileOutputStream(file));
+}
+
+/*************************************************************************/
+
+/**
+ * This method initializes a new <code>FileWriter</code> object to write
+ * to the specified <code>FileDescriptor</code> object.
+ *
+ * @param fd The <code>FileDescriptor</code> object to write to
+ *
+ * @param SecurityException If writing to this file is forbidden by the
+ * <code>SecurityManager</code>.
+ */
+public
+FileWriter(FileDescriptor fd) throws SecurityException
+{
+ super(new FileOutputStream(fd));
+}
+
+/*************************************************************************/
+
+/**
+ * This method intializes a new <code>FileWriter</code> object to write to the
+ * specified named file.
+ *
+ * @param name The name of the file to write to
+ *
+ * @param SecurityException If writing to this file is forbidden by the
+ * <code>SecurityManager</code>.
+ * @param IOException If any other error occurs
+ */
+public
+FileWriter(String name) throws IOException
+{
+ super(new FileOutputStream(name));
}
+
+/*************************************************************************/
+
+/**
+ * This method intializes a new <code>FileWriter</code> object to write to the
+ * specified named file. This form of the constructor allows the caller
+ * to determin whether data should be written starting at the beginning or
+ * the end of the file.
+ *
+ * @param name The name of the file to write to
+ * @param append <code>true</code> to start adding data at the end of the
+ * file, <code>false</code> otherwise.
+ *
+ * @param SecurityException If writing to this file is forbidden by the
+ * <code>SecurityManager</code>.
+ * @param IOException If any other error occurs
+ */
+public
+FileWriter(String name, boolean append) throws IOException
+{
+ super(new FileOutputStream(name, append));
+}
+
+} // class FileWriter
+
diff --git a/libjava/java/io/FilterInputStream.java b/libjava/java/io/FilterInputStream.java
index 712be92..5b09312 100644
--- a/libjava/java/io/FilterInputStream.java
+++ b/libjava/java/io/FilterInputStream.java
@@ -1,75 +1,237 @@
-/* Copyright (C) 1998, 1999 Free Software Foundation
+/* FilterInputStream.java -- Base class for classes that filter input
+ Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
+
+
package java.io;
-/**
- * @author Warren Levy <warrenl@cygnus.com>
- * @date October 8, 1998.
- */
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct.
*/
-
+
+/**
+ * This is the common superclass of all standard classes that filter
+ * input. It acts as a layer on top of an underlying <code>InputStream</code>
+ * and simply redirects calls made to it to the subordinate InputStream
+ * instead. Subclasses of this class perform additional filtering
+ * functions in addition to simply redirecting the call.
+ * <p>
+ * This class is not abstract. However, since it only redirects calls
+ * to a subordinate <code>InputStream</code> without adding any functionality
+ * on top of it, this class should not be used directly. Instead, various
+ * subclasses of this class should be used. This is enforced with a
+ * protected constructor. Do not try to hack around it.
+ * <p>
+ * When creating a subclass of <code>FilterInputStream</code>, override the
+ * appropriate methods to implement the desired filtering. However, note
+ * that the <code>read(byte[])</code> method does not need to be overridden
+ * as this class redirects calls to that method to
+ * <code>read(byte[], int, int)</code> instead of to the subordinate
+ * <code>InputStream read(byte[])</code> method.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy <warrenl@cygnus.com>
+ */
public class FilterInputStream extends InputStream
{
- /* The input stream to be filtered. */
- protected InputStream in;
-
- protected FilterInputStream(InputStream in)
- {
- this.in = in;
- }
-
- public int available() throws IOException
- {
- return in.available();
- }
-
- public void close() throws IOException
- {
- in.close();
- }
-
- public synchronized void mark(int readlimit)
- {
- in.mark(readlimit);
- }
-
- public boolean markSupported()
- {
- return in.markSupported();
- }
-
- public int read() throws IOException
- {
- return in.read();
- }
-
- public int read(byte[] b) throws IOException
- {
- return read(b, 0, b.length);
- }
-
- public int read(byte[] b, int off, int len) throws IOException
- {
- return in.read(b, off, len);
- }
-
- public synchronized void reset() throws IOException
- {
- in.reset();
- }
-
- public long skip(long n) throws IOException
- {
- return in.skip(n);
- }
+
+/*************************************************************************/
+
+/*
+ * Instance Variables
+ */
+
+/**
+ * This is the subordinate <code>InputStream</code> to which method calls
+ * are redirected
+ */
+protected InputStream in;
+
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+/**
+ * Create a <code>FilterInputStream</code> with the specified subordinate
+ * <code>InputStream</code>.
+ *
+ * @param in The subordinate <code>InputStream</code>
+ */
+protected
+FilterInputStream(InputStream in)
+{
+ this.in = in;
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * Calls the <code>in.mark(int)</code> method.
+ *
+ * @param readlimit The parameter passed to <code>in.mark(int)</code>
+ */
+public void
+mark(int readlimit)
+{
+ in.mark(readlimit);
+}
+
+/*************************************************************************/
+
+/**
+ * Calls the <code>in.markSupported()</code> method.
+ *
+ * @return <code>true</code> if mark/reset is supported, <code>false</code>
+ * otherwise
+ */
+public boolean
+markSupported()
+{
+ return(in.markSupported());
+}
+
+/*************************************************************************/
+
+/**
+ * Calls the <code>in.reset()</code> method.
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+reset() throws IOException
+{
+ in.reset();
+}
+
+/*************************************************************************/
+
+/**
+ * Calls the <code>in.available()</code> method.
+ *
+ * @return The value returned from <code>in.available()</code>
+ *
+ * @exception IOException If an error occurs
+ */
+public int
+available() throws IOException
+{
+ return(in.available());
+}
+
+/*************************************************************************/
+
+/**
+ * Calls the <code>in.skip(long)</code> method
+ *
+ * @param The requested number of bytes to skip.
+ *
+ * @return The value returned from <code>in.skip(long)</code>
+ *
+ * @exception IOException If an error occurs
+ */
+public long
+skip(long num_bytes) throws IOException
+{
+ return(in.skip(num_bytes));
+}
+
+/*************************************************************************/
+
+/**
+ * Calls the <code>in.read()</code> method
+ *
+ * @return The value returned from <code>in.read()</code>
+ *
+ * @exception IOException If an error occurs
+ */
+public int
+read() throws IOException
+{
+ return(in.read());
}
+
+/*************************************************************************/
+
+/**
+ * Calls the <code>read(byte[], int, int)</code> overloaded method. Note that
+ * this method does not redirect its call directly to a corresponding
+ * method in <code>in</code>. This allows subclasses to override only the
+ * three argument version of <code>read</code>.
+ *
+ * @param buf The buffer to read bytes into
+ *
+ * @return The value retured from <code>in.read(byte[], int, int)</code>
+ *
+ * @exception IOException If an error occurs
+ */
+public int
+read(byte[] buf) throws IOException
+{
+ return(read(buf, 0, buf.length));
+}
+
+/*************************************************************************/
+
+/**
+ * Calls the <code>in.read(byte[], int, int)</code> method.
+ *
+ * @param buf The buffer to read bytes into
+ * @param offset The index into the buffer to start storing bytes
+ * @param len The maximum number of bytes to read.
+ *
+ * @return The value retured from <code>in.read(byte[], int, int)</code>
+ *
+ * @exception IOException If an error occurs
+ */
+public int
+read(byte[] buf, int offset, int len) throws IOException
+{
+ return(in.read(buf, offset, len));
+}
+
+/*************************************************************************/
+
+/**
+ * This method closes the input stream by closing the input stream that
+ * this object is filtering. Future attempts to access this stream may
+ * throw an exception.
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+close() throws IOException
+{
+ in.close();
+}
+
+} // class FilterInputStream
diff --git a/libjava/java/io/FilterOutputStream.java b/libjava/java/io/FilterOutputStream.java
index c17ea26..53e519c 100644
--- a/libjava/java/io/FilterOutputStream.java
+++ b/libjava/java/io/FilterOutputStream.java
@@ -1,62 +1,171 @@
-// FilterOutputStream.java - A filtered stream
+/* FilterOutputStream.java -- Parent class for output streams that filter
+ Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
-/* Copyright (C) 1998, 1999 Free Software Foundation
+This file is part of GNU Classpath.
- This file is part of libgcj.
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
-package java.io;
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-/**
- * @author Tom Tromey <tromey@cygnus.com>
- * @date September 24, 1998
- */
+
+package java.io;
/* 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.1.
*/
+/**
+ * This class is the common superclass of output stream classes that
+ * filter the output they write. These classes typically transform the
+ * data in some way prior to writing it out to another underlying
+ * <code>OutputStream</code>. This class simply overrides all the
+ * methods in <code>OutputStream</code> to redirect them to the
+ * underlying stream. Subclasses provide actual filtering.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey <tromey@cygnus.com>
+ */
public class FilterOutputStream extends OutputStream
{
- public void close () throws IOException
- {
- flush ();
- out.close();
- }
-
- public FilterOutputStream (OutputStream ox)
- {
- out = ox;
- }
-
- public void flush () throws IOException
- {
- out.flush();
- }
-
- public void write (int b) throws IOException
- {
- out.write(b);
- }
-
- public void write (byte[] b) throws IOException, NullPointerException
- {
- // Don't do checking here, per Java Lang Spec.
- write (b, 0, b.length);
- }
-
- public void write (byte[] b, int off, int len)
- throws IOException, NullPointerException, IndexOutOfBoundsException
- {
- // Don't do checking here, per Java Lang Spec.
- for (int i=0; i < len; i++)
- write (b[off + i]);
- }
-
- // The output stream.
- protected OutputStream out;
+
+/*************************************************************************/
+
+/*
+ * Instance Variables
+ */
+
+/**
+ * This is the subordinate <code>OutputStream</code> that this class
+ * redirects its method calls to.
+ */
+protected OutputStream out;
+
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+/**
+ * This method initializes an instance of <code>FilterOutputStream</code>
+ * to write to the specified subordinate <code>OutputStream</code>.
+ *
+ * @param out The <code>OutputStream</code> to write to
+ */
+public
+FilterOutputStream(OutputStream out)
+{
+ this.out = out;
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * This method closes the underlying <code>OutputStream</code>. Any
+ * further attempts to write to this stream may throw an exception.
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+close() throws IOException
+{
+ flush();
+ out.close();
+}
+
+/*************************************************************************/
+
+/**
+ * This method attempt to flush all buffered output to be written to the
+ * underlying output sink.
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+flush() throws IOException
+{
+ out.flush();
}
+
+/*************************************************************************/
+
+/**
+ * This method writes a single byte of output to the underlying
+ * <code>OutputStream</code>.
+ *
+ * @param b The byte to write, passed as an int.
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+write(int b) throws IOException
+{
+ out.write(b);
+}
+
+/*************************************************************************/
+
+/**
+ * This method writes all the bytes in the specified array to the underlying
+ * <code>OutputStream</code>. It does this by calling the three parameter
+ * version of this method - <code>write(byte[], int, int)</code> in this
+ * class instead of writing to the underlying <code>OutputStream</code>
+ * directly. This allows most subclasses to avoid overriding this method.
+ *
+ * @param buf The byte array to write bytes from
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+write(byte[] buf) throws IOException
+{
+ // Don't do checking here, per Java Lang Spec.
+ write(buf, 0, buf.length);
+}
+
+/*************************************************************************/
+
+/**
+ * This method calls the <code>write(int)</code> method <code>len</code>
+ * times for all bytes from the array <code>buf</code> starting at index
+ * <code>offset</code>. Subclasses should overwrite this method to get a
+ * more efficient implementation.
+ *
+ * @param buf The byte array to write bytes from
+ * @param offset The index into the array to start writing bytes from
+ * @param len The number of bytes to write
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+write(byte[] buf, int offset, int len) throws IOException
+{
+ // Don't do checking here, per Java Lang Spec.
+ for (int i=0; i < len; i++)
+ write(buf[offset + i]);
+
+}
+
+} // class FilterOutputStream
diff --git a/libjava/java/io/FilterReader.java b/libjava/java/io/FilterReader.java
index 608f910..a3897bc 100644
--- a/libjava/java/io/FilterReader.java
+++ b/libjava/java/io/FilterReader.java
@@ -1,75 +1,214 @@
-/* Copyright (C) 1998, 1999, 2001 Free Software Foundation
+/* FilterReader.java -- Base class for char stream classes that filter input
+ Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.io;
-/**
- * @author Warren Levy <warrenl@cygnus.com>
- * @date October 15, 1998.
- */
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct.
*/
-
+
+/**
+ * This is the common superclass of all standard classes that filter
+ * input. It acts as a layer on top of an underlying <code>Reader</code>
+ * and simply redirects calls made to it to the subordinate Reader
+ * instead. Subclasses of this class perform additional filtering
+ * functions in addition to simply redirecting the call.
+ * <p>
+ * When creating a subclass of <code>FilterReader</code>, override the
+ * appropriate methods to implement the desired filtering. However, note
+ * that the <code>read(char[])</code> method does not need to be overridden
+ * as this class redirects calls to that method to
+ * <code>read(yte[], int, int)</code> instead of to the subordinate
+ * <code>Reader} read(yte[])</code> method.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy <warrenl@cygnus.com>
+ */
public abstract class FilterReader extends Reader
{
- /* The input stream to be filtered. */
- protected Reader in;
-
- protected FilterReader(Reader in)
- {
- super(in.lock);
- this.in = in;
- }
-
- public void close() throws IOException
- {
- // We used to set `in = null' here. We don't, though, because
- // that is the simplest way to ensure that read-after-close will
- // throw the appropriate exception -- we rely on the filtered
- // stream to do it.
- in.close();
- }
-
- public synchronized void mark(int readlimit) throws IOException
- {
- in.mark(readlimit);
- }
-
- public boolean markSupported()
- {
- return in.markSupported();
- }
-
- public int read() throws IOException
- {
- return in.read();
- }
-
- public int read(char[] b, int off, int len) throws IOException
- {
- return in.read(b, off, len);
- }
-
- public boolean ready() throws IOException
- {
- return in.ready();
- }
-
- public synchronized void reset() throws IOException
- {
- in.reset();
- }
-
- public long skip(long n) throws IOException
- {
- return in.skip(n);
- }
+
+/*************************************************************************/
+
+/*
+ * Instance Variables
+ */
+
+/**
+ * This is the subordinate <code>Reader</code> to which method calls
+ * are redirected
+ */
+protected Reader in;
+
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+/**
+ * Create a <code>FilterReader</code> with the specified subordinate
+ * <code>Reader</code>.
+ * The <code>lock</code> of the new <code>FilterReader</code> will be set
+ * to <code>in.lock</code>.
+ *
+ * @param in The subordinate <code>Reader</code>
+ */
+protected
+FilterReader(Reader in)
+{
+ super(in.lock);
+ this.in = in;
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * Calls the <code>in.mark(int)</code> method.
+ *
+ * @param readlimit The parameter passed to <code>in.mark(int)</code>
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+mark(int readlimit) throws IOException
+{
+ in.mark(readlimit);
+}
+
+/*************************************************************************/
+
+/**
+ * Calls the <code>in.markSupported()</code> method.
+ *
+ * @return <code>true</code> if mark/reset is supported, <code>false</code> otherwise
+ */
+public boolean
+markSupported()
+{
+ return(in.markSupported());
}
+
+/*************************************************************************/
+
+/**
+ * Calls the <code>in.reset()</code> method.
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+reset() throws IOException
+{
+ in.reset();
+}
+
+/*************************************************************************/
+
+/**
+ * Calls the <code>in.read()</code> method.
+ *
+ * @return The value returned from <code>in.available()</code>
+ *
+ * @exception IOException If an error occurs
+ */
+public boolean
+ready() throws IOException
+{
+ return(in.ready());
+}
+
+/*************************************************************************/
+
+/**
+ * Calls the <code>in.skip(long)</code> method
+ *
+ * @param The requested number of chars to skip.
+ *
+ * @return The value returned from <code>in.skip(long)</code>
+ *
+ * @exception IOException If an error occurs
+ */
+public long
+skip(long num_chars) throws IOException
+{
+ return(in.skip(num_chars));
+}
+
+/*************************************************************************/
+
+/**
+ * Calls the <code>in.read()</code> method
+ *
+ * @return The value returned from <code>in.read()</code>
+ *
+ * @exception IOException If an error occurs
+ */
+public int
+read() throws IOException
+{
+ return(in.read());
+}
+
+/*************************************************************************/
+
+/**
+ * Calls the <code>in.read(char[], int, int)</code> method.
+ *
+ * @param buf The buffer to read chars into
+ * @param offset The index into the buffer to start storing chars
+ * @param len The maximum number of chars to read.
+ *
+ * @return The value retured from <code>in.read(char[], int, int)</code>
+ *
+ * @exception IOException If an error occurs
+ */
+public int
+read(char[] buf, int offset, int len) throws IOException
+{
+ return(in.read(buf, offset, len));
+}
+
+/*************************************************************************/
+
+/**
+ * This method closes the stream by calling the <code>close()</code> method
+ * of the underlying stream.
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+close() throws IOException
+{
+ in.close();
+}
+
+} // class FilterReader
diff --git a/libjava/java/io/FilterWriter.java b/libjava/java/io/FilterWriter.java
index aa6600c..eaa7066 100644
--- a/libjava/java/io/FilterWriter.java
+++ b/libjava/java/io/FilterWriter.java
@@ -1,58 +1,168 @@
-// FilterWriter.java - Filtered character output stream.
+/* FilterWriter.java -- Parent class for output streams that filter
+ Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
-/* Copyright (C) 1998, 1999 Free Software Foundation
+This file is part of GNU Classpath.
- This file is part of libgcj.
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
-package java.io;
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-/**
- * @author Tom Tromey <tromey@cygnus.com>
- * @date September 25, 1998
- */
+
+package java.io;
/* 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.1.
*/
+/**
+ * This class is the common superclass of output character stream classes
+ * that filter the output they write. These classes typically transform the
+ * data in some way prior to writing it out to another underlying
+ * <code>Writer</code>. This class simply overrides all the
+ * methods in <code>Writer</code> to redirect them to the
+ * underlying stream. Subclasses provide actual filtering.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey <tromey@cygnus.com>
+ */
public abstract class FilterWriter extends Writer
{
- public void close () throws IOException
- {
- out.close();
- }
-
- protected FilterWriter (Writer ox)
- {
- super (ox);
- out = ox;
- }
-
- public void flush () throws IOException
- {
- out.flush();
- }
-
- public void write (int oneChar) throws IOException
- {
- out.write(oneChar);
- }
-
- public void write (char[] buffer, int offset, int count) throws IOException
- {
- out.write(buffer, offset, count);
- }
-
- public void write (String str, int offset, int count) throws IOException
- {
- out.write(str, offset, count);
- }
-
- // Where our writes should go.
- protected Writer out;
+
+/*************************************************************************/
+
+/*
+ * Instance Variables
+ */
+
+/**
+ * This is the subordinate <code>Writer</code> that this class
+ * redirects its method calls to.
+ */
+protected Writer out;
+
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+/**
+ * This method initializes an instance of <code>FilterWriter</code>
+ * to write to the specified subordinate <code>Writer</code>.
+ * The given <code>Writer</code> will be used as <code>lock</code> for
+ * the newly created <code>FilterWriter</code>.
+ *
+ * @param out The <code>Writer</code> to write to
+ */
+protected
+FilterWriter(Writer out)
+{
+ super(out);
+ this.out = out;
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * This method closes the underlying <code>Writer</code>. Any
+ * further attempts to write to this stream may throw an exception.
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+close() throws IOException
+{
+ out.close();
+}
+
+/*************************************************************************/
+
+/**
+ * This method attempt to flush all buffered output to be written to the
+ * underlying output sink.
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+flush() throws IOException
+{
+ out.flush();
}
+
+/*************************************************************************/
+
+/**
+ * This method writes a single char of output to the underlying
+ * <code>Writer</code>.
+ *
+ * @param b The char to write, passed as an int.
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+write(int b) throws IOException
+{
+ out.write(b);
+}
+
+/*************************************************************************/
+
+/**
+ * This method writes <code>len</code> chars from the array <code>buf</code>
+ * starting at index <code>offset</code> to the underlying
+ * <code>Writer</code>.
+ *
+ * @param buf The char array to write chars from
+ * @param offset The index into the array to start writing chars from
+ * @param len The number of chars to write
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+write(char[] buf, int offset, int len) throws IOException
+{
+ out.write(buf, offset, len);
+}
+
+/*************************************************************************/
+
+/**
+ * This method writes <code>len</code> chars from the <code>String</code>
+ * starting at position <code>offset</code>.
+ *
+ * @param str The <code>String</code> that is to be written
+ * @param offset The character offset into the <code>String</code> to start writing from
+ * @param len The number of chars to write
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+write(String str, int offset, int len) throws IOException
+{
+ out.write(str, offset, len);
+}
+
+} // class FilterWriter
+
diff --git a/libjava/java/io/Writer.java b/libjava/java/io/Writer.java
index 96fa0fb..2ce5ca3 100644
--- a/libjava/java/io/Writer.java
+++ b/libjava/java/io/Writer.java
@@ -1,67 +1,211 @@
-/* Copyright (C) 1998, 1999 Free Software Foundation
+/* Writer.java -- Base class for character output streams
+ Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
+
+
package java.io;
-/**
- * @author Per Bothner <bothner@cygnus.com>
- * @date April 17, 1998.
- */
/* Written using "Java Class Libraries", 2nd edition, plus online
* API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct.
- * However, write(String, int, int) should be made a native method.
*/
+/**
+ * This abstract class forms the base of the hierarchy of classes that
+ * write output as a stream of chars. It provides a common set of methods
+ * for writing chars to stream. Subclasses implement and/or extend these
+ * methods to write chars in a particular manner or to a particular
+ * destination such as a file on disk or network connection.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Per Bothner <bothner@cygnus.com>
+ */
public abstract class Writer
{
- protected Object lock;
-
- protected Writer ()
- {
- lock = this;
- }
-
- protected Writer (Object lock)
- {
- this.lock = lock;
- }
-
- abstract public void close() throws IOException;
-
- abstract public void flush() throws IOException;
-
- abstract public void write(char[] buf, int offset, int count)
- throws IOException;
-
- public void write(char[] buf) throws IOException
- {
- write(buf, 0, buf.length);
- }
-
- public void write(int ch) throws IOException
- {
- char[] buf = new char[1];
- buf[0] = (char) ch;
- write(buf, 0, 1);
- }
-
- // FIXME - re-write using native code to not require copied buffer.
- public void write (String str, int offset, int count) throws IOException
- {
- char[] buf = new char[count];
- str.getChars(offset, offset + count, buf, 0);
- write(buf, 0, count);
- }
-
- public void write (String str) throws IOException
- {
- write(str, 0, str.length());
- }
+/*************************************************************************/
+
+/**
+ * This is the object used to synchronize criticial code sections for
+ * thread safety. Subclasses should use this field instead of using
+ * synchronized methods or explicity synchronizations on <code>this</code>
+ */
+protected Object lock;
+
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+/**
+ * This is the default no-argument constructor for this class. This method
+ * will set up the class to synchronize criticial sections on itself.
+ */
+protected
+Writer()
+{
+ lock = this;
}
+
+/*************************************************************************/
+
+/**
+ * This method initializes a <code>Writer</code> that will synchronize
+ * on the specified <code>Object</code>.
+ *
+ * @param obj The <code>Object</code> to use for synchronizing critical
+ * sections
+ */
+protected
+Writer(Object lock)
+{
+ this.lock = lock;
+}
+
+/*************************************************************************/
+
+/*
+ * Instance Methods
+ */
+
+/**
+ * This method forces any data that may have been buffered to be written
+ * to the underlying output device. Please note that the host environment
+ * might perform its own buffering unbeknowst to Java. In that case, a
+ * write made (for example, to a disk drive) might be cached in OS
+ * buffers instead of actually being written to disk.
+ *
+ * @exception IOException If an error occurs
+ */
+public abstract void
+flush() throws IOException;
+
+/*************************************************************************/
+
+/**
+ * This method closes the stream. Any internal or native resources associated
+ * with this stream are freed. Any subsequent attempt to access the stream
+ * might throw an exception.
+ * <p>
+ * This method in this class does nothing.
+ *
+ * @exception IOException If an error occurs
+ */
+public abstract void
+close() throws IOException;
+
+/*************************************************************************/
+
+/**
+ * This method writes a single char to the output stream.
+ *
+ * @param b The char to be written to the output stream, passed as an int
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+write(int b) throws IOException
+{
+ char[] buf = new char[1];
+
+ buf[0] = (char)b;
+ write(buf, 0, buf.length);
+}
+
+/*************************************************************************/
+
+/**
+ * This method all the writes char from the passed array to the output stream.
+ * This method is equivalent to <code>write(buf, 0, buf.length)</code> which
+ * is exactly how it is implemented in this class.
+ *
+ * @param buf The array of char to write
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+write(char[] buf) throws IOException
+{
+ write(buf, 0, buf.length);
+}
+
+/*************************************************************************/
+
+/**
+ * This method writes <code>len</code> char from the specified array
+ * <code>buf</code> starting at index <code>offset</code> into the array.
+ * <p>
+ * Subclasses must provide an implementation of this abstract method.
+ *
+ * @param buf The array of char to write from
+ * @param offset The index into the array to start writing from
+ * @param len The number of char to write
+ *
+ * @exception IOException If an error occurs
+ */
+public abstract void
+write(char[] buf, int offset, int len) throws IOException;
+
+/*************************************************************************/
+
+/**
+ * This method writes all the characters in a <code>String</code> to the
+ * output.
+ *
+ * @param str The <code>String</code> whose chars are to be written.
+ *
+ * @param IOException If an error occurs
+ */
+public void
+write(String str) throws IOException
+{
+ write(str, 0, str.length());
+}
+
+/*************************************************************************/
+
+/**
+ * This method writes <code>len</code> chars from the <code>String</code>
+ * starting at position <code>offset</code>.
+ *
+ * @param str The <code>String</code> that is to be written
+ * @param offset The character offset into the <code>String</code> to start
+ * writing from
+ * @param len The number of chars to write
+ *
+ * @exception IOException If an error occurs
+ */
+public void
+write(String str, int offset, int len) throws IOException
+{
+ // FIXME - for libgcj re-write using native code to not require copied buffer.
+ char[] buf = new char[len];
+
+ str.getChars(offset, offset + len, buf, 0);
+ write(buf, 0, len);
+}
+
+} // class Writer
diff --git a/libjava/java/lang/Compiler.java b/libjava/java/lang/Compiler.java
index bb0f784..bca1031 100644
--- a/libjava/java/lang/Compiler.java
+++ b/libjava/java/lang/Compiler.java
@@ -1,53 +1,111 @@
-// Compiler.java - Control byte->machine code compiler.
+/* Compiler.java -- Interface for implementing a method to override
+ Object.clone()comparaing objects to obtain an ordering
+ Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
-/* Copyright (C) 1998, 1999 Free Software Foundation
+This file is part of GNU Classpath.
- This file is part of libgcj.
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
-package java.lang;
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-/**
- * @author Tom Tromey <tromey@cygnus.com>
- * @date October 23, 1998.
- */
+
+package java.lang;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
*/
-public final class Compiler
+/**
+ * The <code>Compiler</code> class is a place holder for a JIT
+ * compiler implementation does nothing unless there is such a
+ * compiler by default.
+ * <p>
+ * The system property <code>java.compiler</code> may contain the name
+ * of a library to load with <code>System.loadLibrary</code> when the
+ * virtual machine first starts. If so and loading the library succeeds,
+ * then a function by the name of <code>java_lang_Compiler_start()</code>
+ * in that library is called.
+ *
+ * Note that a VM might not have implemented any of this.
+ *
+ * @author Tom Tromey <tromey@cygnus.com>
+ *
+ * @since JDK 1.0
+ * @see System#getProperty(java.lang.String)
+ * @see System#getProperty(java.lang.String,java.lang.String)
+ * @see System#loadLibrary(java.lang.String)
+ */
+public final class Compiler
{
- public static Object command (Object arg)
+ /**
+ * Don't allow new `Compiler's to be made.
+ */
+ private Compiler ()
{
- // Our implementation defines this to a no-op.
- return null;
}
- public static boolean compileClass (Class oneClass)
+ /**
+ * Compile the class named by <code>oneClass</code>.
+ *
+ * @param oneClass the class to compile
+ * @return <code>false</code> if no compiler is available or
+ * compilation failed and <code>true</code> if compilation succeeded.
+ */
+ public static boolean compileClass (Class oneClass)
{
- // Never succeed.
- return false;
+ // Never succeed.
+ return false;
}
-
- public static boolean compileClasses (String classNames)
+
+ /**
+ * Compile the classes whose name matches <code>classNames/code>.
+ *
+ * @param classNames the name of classes to compile
+ * @return <code>false</code> if no compiler is available or
+ * compilation failed and <code>true</code> if compilation succeeded.
+ */
+ public static boolean compileClasses (String classNames)
{
- // Note the incredibly lame interface. Always fail.
- return false;
+ // Note the incredibly lame interface. Always fail.
+ return false;
}
- public static void disable ()
+ /**
+ * This method examines the argument and performs an operation
+ * according to the compilers documentation. No specific operation
+ * is required.
+ */
+ public static Object command (Object arg)
{
+ // Our implementation defines this to a no-op.
+ return null;
}
- public static void enable ()
- {
- }
+ /**
+ * Calling <code>Compiler.enable()</code> will cause the compiler
+ * to resume operation if it was previously disabled.
+ */
+ public static void enable () { }
- // Don't allow new `Compiler's to be made.
- private Compiler ()
- {
- }
+ /**
+ * Calling <code>Compiler.disable()</code> will cause the compiler
+ * to be suspended.
+ */
+ public static void disable () { }
}
diff --git a/libjava/java/lang/Process.java b/libjava/java/lang/Process.java
index 077efe5..faeb1ed 100644
--- a/libjava/java/lang/Process.java
+++ b/libjava/java/lang/Process.java
@@ -1,30 +1,106 @@
-// Process.java - Represent spawned system process.
+/* Process.java - Represent spawned system process.
+ Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
-/* Copyright (C) 1998, 1999 Free Software Foundation
+This file is part of GNU Classpath.
- This file is part of libgcj.
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.lang;
-import java.io.*;
-/**
- * @author Tom Tromey <tromey@cygnus.com>
- * @date October 23, 1998.
- */
+import java.io.OutputStream;
+import java.io.InputStream;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
*/
+/**
+ * An instance of a subclass of <code>Process</code> is created by the
+ * <code>Runtime.exec</code> methods. Methods in <code>Process</code>
+ * provide a means to send input to a process, obtain the output from a
+ * subprocess, destroy a subprocess, obtain the exit value from a
+ * subprocess, and wait for a subprocess to complete.
+ *
+ * @since JDK 1.0
+ *
+ * @author Brian Jones
+ * @author Tom Tromey <tromey@cygnus.com>
+ */
public abstract class Process
{
- abstract public void destroy ();
- abstract public int exitValue ();
- abstract public InputStream getErrorStream ();
- abstract public InputStream getInputStream ();
- abstract public OutputStream getOutputStream ();
- abstract public int waitFor () throws InterruptedException;
+ /**
+ * Empty constructor does nothing.
+ */
+ public Process() { }
+
+ /**
+ * Obtain the output stream of the subprocess. It may help to
+ * associate this stream as the redirected STDIN file descriptor of
+ * the subprocess.
+ */
+ public abstract OutputStream getOutputStream();
+
+ /**
+ * Obtain the input stream of the subprocess. It may help to
+ * associate this stream as the redirected STDOUT file descriptor of
+ * the subprocess.
+ */
+ public abstract InputStream getInputStream();
+
+ /**
+ * Obtain the error input stream of the subprocess. It may help to
+ * associate this stream as the redirected STDERR file descriptor of
+ * the subprocess.
+ */
+ public abstract InputStream getErrorStream();
+
+ /**
+ * The thread calling <code>waitFor</code> will block until the subprocess
+ * has terminated. If the process has already terminated then the method
+ * immediately returns with the exit value of the subprocess.
+ *
+ * @returns the exit value of the subprocess. A return of <code>0</code>
+ * denotes normal process termination by convention.
+ *
+ * @throws InterruptedException is thrown if another thread interrupts
+ * the waiting thread. The waiting thread stops waiting.
+ */
+ public abstract int waitFor()
+ throws InterruptedException;
+
+ /**
+ * When a process terminates there is associated with that termination
+ * an exit value for the process to indicate why it terminated. A return
+ * of <code>0</code> denotes normal process termination by convention.
+ *
+ * @returns the exit value of the subprocess.
+ * @throws IllegalThreadStateException is thrown if the subprocess
+ * represented by the subclass of this class has not yet terminated.
+ */
+ public abstract int exitValue();
+
+ /**
+ * Kills the subprocess and all of its children forcibly.
+ */
+ public abstract void destroy();
+
}
diff --git a/libjava/java/lang/Void.java b/libjava/java/lang/Void.java
index 7d5bdfc..453e5fc 100644
--- a/libjava/java/lang/Void.java
+++ b/libjava/java/lang/Void.java
@@ -1,30 +1,56 @@
-/* Copyright (C) 1998, 1999 Free Software Foundation
+/* java.lang.Void
+ Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
- This file is part of libgcj.
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
package java.lang;
-/**
- * @author Per Bothner <bothner@cygnus.com>
- * @date April 18, 1998.
- */
/* Written using "Java Class Libraries", 2nd edition, plus online
* API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Complete.
*/
+/**
+ * Void is a placeholder class so that the variable Void.TYPE can be
+ * supported for reflection return types.
+ *
+ * @author Paul Fisher
+ * @author John Keiser
+ * @author Per Bothner <bothner@cygnus.com>
+ * @since JDK1.1
+ */
public final class Void
{
- // This initialization is seemingly circular, but it is accepted
- // by javac, and is handled specially by gcc.
- public final static Class TYPE = void.class;
-
- // Don't allow Void objects to be made.
- private Void ()
- {
- }
+ /**
+ * The return type <code>void</code> is represented by this
+ * <code>Class</code> object.
+ */
+ public static final Class TYPE = VMClassLoader.getPrimitiveClass("void");
+
+ /**
+ * Don't allow Void objects to be made.
+ */
+ private Void() { }
}
diff --git a/libjava/java/net/ContentHandler.java b/libjava/java/net/ContentHandler.java
index 59bdb1e..a0ed737 100644
--- a/libjava/java/net/ContentHandler.java
+++ b/libjava/java/net/ContentHandler.java
@@ -1,29 +1,80 @@
-// ContentHandler.java - Superclass of classes that read from a URLConnection.
+/* ContentHandler.java -- Abstract class for handling content from URL's
+ Copyright (C) 1998, 1999 2000, 2001 Free Software Foundation, Inc.
-/* Copyright (C) 1999 Free Software Foundation
+This file is part of GNU Classpath.
- This file is part of libgcj.
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.net;
import java.io.IOException;
/**
- * @author Warren Levy <warrenl@cygnus.com>
- * @date March 5, 1999.
- */
-
-/**
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* Status: Believed complete and correct.
*/
+/**
+ * This is an abstract class that is the superclass for classes that read
+ * objects from URL's. Calling the <code>getContent()</code> method in the
+ * <code>URL</code> class or the <code>URLConnection</code> class will cause
+ * an instance of a subclass of <code>ContentHandler</code> to be created for
+ * the MIME type of the object being downloaded from the URL. Thus, this
+ * class is seldom needed by applications/applets directly, but only
+ * indirectly through methods in other classes.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy <warrenl@cygnus.com>
+ */
public abstract class ContentHandler
{
- public abstract Object getContent(URLConnection urlc) throws IOException;
-}
+
+/*************************************************************************/
+
+/*
+ * Constructors
+ */
+
+/**
+ * Default, no-argument constructor.
+ */
+public ContentHandler() { }
+
+/*************************************************************************/
+
+/**
+ * This method reads from the <code>InputStream</code> of the passed in URL
+ * connection and uses the data downloaded to create an <code>Object</code>
+ * represening the content. For example, if the URL is pointing to a GIF
+ * file, this method might return an <code>Image</code> object. This method
+ * must be implemented by subclasses.
+ *
+ * @param urlc A <code>URLConnection</code> object to read data from.
+ *
+ * @return An object representing the data read
+ *
+ * @exception IOException If an error occurs
+ */
+public abstract Object getContent(URLConnection urlc) throws IOException;
+
+} // class ContentHandler
diff --git a/libjava/java/net/DatagramPacket.java b/libjava/java/net/DatagramPacket.java
index b08f673..3e16628 100644
--- a/libjava/java/net/DatagramPacket.java
+++ b/libjava/java/net/DatagramPacket.java
@@ -1,35 +1,99 @@
-// DatagramPacket.java - Represents packets in a connectionless protocol.
+/* DatagramPacket.java -- Class to model a packet to be sent via UDP
+ Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
-/* Copyright (C) 1999, 2000 Free Software Foundation
+This file is part of GNU Classpath.
- This file is part of libgcj.
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
-package java.net;
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
-/**
- * @author Warren Levy <warrenl@cygnus.com>
- * @date April 28, 1999.
- */
+package java.net;
-/**
+/*
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* Status: Believed complete and correct.
*/
+/**
+ * This class models a packet of data that is to be sent across the network
+ * using a connectionless protocol such as UDP. It contains the data
+ * to be send, as well as the destination address and port. Note that
+ * datagram packets can arrive in any order and are not guaranteed to be
+ * delivered at all.
+ * <p>
+ * This class can also be used for receiving data from the network.
+ * <p>
+ * Note that for all method below where the buffer length passed by the
+ * caller cannot exceed the actually length of the byte array passed as
+ * the buffer, if this condition is not true, then the method silently
+ * reduces the length value to maximum allowable value.
+ *
+ * Written using on-line Java Platform 1.2 API Specification, as well
+ * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
+ * Status: Believed complete and correct.
+ *
+ * @author Warren Levy <warrenl@cygnus.com>
+ * @author Aarom M. Renn (arenn@urbanophile.com) (Documentation comments)
+ * @date April 28, 1999.
+ */
+
public final class DatagramPacket
{
+/**
+ * The data buffer to send
+ */
private byte[] buffer;
+
+/**
+ * This is the offset into the buffer to start sending from or receiving to.
+ */
private int offset;
+
+/**
+ * The length of the data buffer to send
+ */
private int length;
+
+/**
+ * The address to which the packet should be sent or from which it
+ * was received
+ */
private InetAddress address;
+
+/**
+ * The port to which the packet should be sent or from which it was
+ * was received.
+ */
private int port;
- // JDK1.2
+/**
+ * This method initializes a new instance of <code>DatagramPacket</code>
+ * which has the specified buffer, offset, and length.
+ *
+ * @param buf The buffer for holding the incoming datagram.
+ * @param offset The offset into the buffer to start writing.
+ * @param length The maximum number of bytes to read.
+ *
+ * @since Java 1.2
+ */
public DatagramPacket(byte[] buf, int offset, int length)
{
if (buf == null)
@@ -49,12 +113,30 @@ public final class DatagramPacket
this.port = -1;
}
+/**
+ * Initializes a new instance of <code>DatagramPacket</code> for
+ * receiving packets from the network.
+ *
+ * @param buf A buffer for storing the returned packet data
+ * @param length The length of the buffer (must be <= buf.length)
+ */
public DatagramPacket(byte[] buf, int length)
{
this(buf, 0, length);
}
- // JDK1.2
+/**
+ * Initializes a new instance of <code>DatagramPacket</code> for
+ * transmitting packets across the network.
+ *
+ * @param buf A buffer containing the data to send
+ * @param offset The offset into the buffer to start writing from.
+ * @param len The length of the buffer (must be <= buf.length)
+ * @param addr The address to send to
+ * @param port The port to send to
+ *
+ * @since Java 1.2
+ */
public DatagramPacket(byte[] buf, int offset, int length,
InetAddress address, int port)
{
@@ -79,37 +161,86 @@ public final class DatagramPacket
this.port = port;
}
+/**
+ * Initializes a new instance of <code>DatagramPacket</code> for
+ * transmitting packets across the network.
+ *
+ * @param buf A buffer containing the data to send
+ * @param length The length of the buffer (must be <= buf.length)
+ * @param address The address to send to
+ * @param port The port to send to
+ */
public DatagramPacket(byte[] buf, int length, InetAddress address, int port)
{
this(buf, 0, length, address, port);
}
+/**
+ * Returns the address that this packet is being sent to or, if it was used
+ * to receive a packet, the address that is was received from. If the
+ * constructor that doesn not take an address was used to create this object
+ * and no packet was actually read into this object, then this method
+ * returns <code>null</code>.
+ *
+ * @return The address for this packet.
+ */
public synchronized InetAddress getAddress()
{
return address;
}
+/**
+ * Returns the port number this packet is being sent to or, if it was used
+ * to receive a packet, the port that it was received from. If the
+ * constructor that doesn not take an address was used to create this object
+ * and no packet was actually read into this object, then this method
+ * will return 0.
+ *
+ * @return The port number for this packet
+ */
public synchronized int getPort()
{
return port;
}
+/**
+ * Returns the data buffer for this packet
+ *
+ * @return This packet's data buffer
+ */
public synchronized byte[] getData()
{
return buffer;
}
- // JDK1.2
+/**
+ * This method returns the current offset value into the data buffer
+ * where data will be sent from.
+ *
+ * @return The buffer offset.
+ *
+ * @since Java 1.2
+ */
public synchronized int getOffset()
{
return offset;
}
+/**
+ * Returns the length of the data in the buffer
+ *
+ * @return The length of the data
+ */
public synchronized int getLength()
{
return length;
}
+/**
+ * This sets the address to which the data packet will be transmitted.
+ *
+ * @param addr The destination address
+ */
public synchronized void setAddress(InetAddress iaddr)
{
if (iaddr == null)
@@ -118,6 +249,11 @@ public final class DatagramPacket
address = iaddr;
}
+/**
+ * This sets the port to which the data packet will be transmitted.
+ *
+ * @param port The destination port
+ */
public synchronized void setPort(int iport)
{
if (iport < 0 || iport > 65535)
@@ -126,6 +262,11 @@ public final class DatagramPacket
port = iport;
}
+/**
+ * Sets the data buffer for this packet.
+ *
+ * @param buf The new buffer for this packet
+ */
public synchronized void setData(byte[] buf)
{
// This form of setData requires setLength to be called separately
@@ -136,7 +277,15 @@ public final class DatagramPacket
buffer = buf;
}
- // JDK1.2
+/**
+ * This method sets the data buffer for the packet.
+ *
+ * @param buf The byte array containing the data for this packet.
+ * @param offset The offset into the buffer to start reading data from.
+ * @param length The number of bytes of data in the buffer.
+ *
+ * @since Java 1.2
+ */
public synchronized void setData(byte[] buf, int offset, int length)
{
// This form of setData must be used if offset is to be changed.
@@ -156,6 +305,11 @@ public final class DatagramPacket
this.length = length;
}
+/**
+ * Sets the length of the data in the buffer.
+ *
+ * @param length The new length. (Where len <= buf.length)
+ */
public synchronized void setLength(int length)
{
if (length < 0)
@@ -166,4 +320,5 @@ public final class DatagramPacket
this.length = length;
}
-}
+} // class DatagramPacket
+
diff --git a/libjava/java/net/MulticastSocket.java b/libjava/java/net/MulticastSocket.java
index c5bee02..a782cff 100644
--- a/libjava/java/net/MulticastSocket.java
+++ b/libjava/java/net/MulticastSocket.java
@@ -1,50 +1,108 @@
-// MulticastSocket.java
-
-/* Copyright (C) 1999, 2000 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
+/* MulticastSocket.java -- Class for using multicast sockets
+ Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+As a special exception, if you link this library with other files to
+produce an executable, this library does not by itself cause the
+resulting executable to be covered by the GNU General Public License.
+This exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License. */
package java.net;
-import java.io.IOException;
-/**
- * @author Warren Levy <warrenl@cygnus.com>
- * @date May 18, 1999.
- */
+import java.io.IOException;
-/**
+/*
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* Status: Believed complete and correct.
*/
+/**
+ * This class models a multicast UDP socket. A multicast address is a
+ * class D internet address (one whose most significant bits are 1110).
+ * A multicast group consists of a multicast address and a well known
+ * port number. All members of the group listening on that address and
+ * port will receive all the broadcasts to the group.
+ * <p>
+ * Please note that applets are not allowed to use multicast sockets
+ *
+ * Written using on-line Java Platform 1.2 API Specification, as well
+ * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
+ * Status: Believed complete and correct.
+ *
+ * @author Warren Levy <warrenl@cygnus.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com) (Documentation comments)
+ * @date May 18, 1999.
+ */
public class MulticastSocket extends DatagramSocket
{
// FIXME: the local addr bound to the multicast socket can be reused;
// unlike unicast sockets. It binds to any available network interface.
// See p.1159 JCL book.
+/**
+ * Create a MulticastSocket that this not bound to any address
+ *
+ * @exception IOException If an error occurs
+ */
public MulticastSocket() throws IOException
{
super(0, ServerSocket.ANY_IF);
}
+/**
+ * Create a multicast socket bound to the specified port
+ *
+ * @param The port to bind to
+ *
+ * @exception IOException If an error occurs
+ */
public MulticastSocket(int port) throws IOException
{
super(port, ServerSocket.ANY_IF);
}
+/**
+ * Returns the interface being used for multicast packets
+ *
+ * @return The multicast interface
+ *
+ * @exception SocketException If an error occurs
+ */
public InetAddress getInterface() throws SocketException
{
// FIXME: Is it possible that an InetAddress wasn't returned from getOption?
return (InetAddress) impl.getOption(SocketOptions.IP_MULTICAST_IF);
}
- // Deprecated in JDK1.2
+/**
+ * Returns the current value of the "Time to Live" option. This is the
+ * number of hops a packet can make before it "expires". This method id
+ * deprecated. Use <code>getTimeToLive</code> instead.
+ *
+ * @return The TTL value
+ *
+ * @exception IOException If an error occurs
+ *
+ * @deprecated Replaced by getTimeToLive() in Java 1.2
+ */
public byte getTTL() throws IOException
{
// Use getTTL here rather than getTimeToLive in case we're using an impl
@@ -53,18 +111,43 @@ public class MulticastSocket extends DatagramSocket
return impl.getTTL();
}
- // JDK1.2
+/**
+ * Returns the current value of the "Time to Live" option. This is the
+ * number of hops a packet can make before it "expires".
+ *
+ * @return The TTL value
+ *
+ * @exception IOException If an error occurs
+ *
+ * @since Java 1.2
+ */
public int getTimeToLive() throws IOException
{
return impl.getTimeToLive();
}
+/**
+ * Sets the interface to use for multicast packets.
+ *
+ * @param addr The new interface to use
+ *
+ * @exception SocketException If an error occurs
+ */
public void setInterface(InetAddress inf) throws SocketException
{
impl.setOption(SocketOptions.IP_MULTICAST_IF, inf);
}
- // Deprecated in JDK1.2
+/**
+ * Sets the "Time to Live" value for a socket. The value must be between
+ * 1 and 255.
+ *
+ * @param ttl The new TTL value
+ *
+ * @exception IOException If an error occurs
+ *
+ * @deprecated Replaced by <code>setTimeToLive</code> in Java 1.2
+ */
public void setTTL(byte ttl) throws IOException
{
// Use setTTL here rather than setTimeToLive in case we're using an impl
@@ -73,7 +156,16 @@ public class MulticastSocket extends DatagramSocket
impl.setTTL(ttl);
}
- // JDK1.2
+/**
+ * Sets the "Time to Live" value for a socket. The value must be between
+ * 1 and 255.
+ *
+ * @param ttl The new TTL value
+ *
+ * @exception IOException If an error occurs
+ *
+ * @since Java 1.2
+ */
public void setTimeToLive(int ttl) throws IOException
{
if (ttl <= 0 || ttl > 255)
@@ -82,6 +174,13 @@ public class MulticastSocket extends DatagramSocket
impl.setTimeToLive(ttl);
}
+/**
+ * Joins the specified mulitcast group.
+ *
+ * @param addr The address of the group to join
+ *
+ * @exception IOException If an error occurs
+ */
public void joinGroup(InetAddress mcastaddr) throws IOException
{
if (! mcastaddr.isMulticastAddress())
@@ -94,6 +193,13 @@ public class MulticastSocket extends DatagramSocket
impl.join(mcastaddr);
}
+/**
+ * Leaves the specified multicast group
+ *
+ * @param addr The address of the group to leave
+ *
+ * @exception IOException If an error occurs
+ */
public void leaveGroup(InetAddress mcastaddr) throws IOException
{
if (! mcastaddr.isMulticastAddress())
@@ -106,6 +212,16 @@ public class MulticastSocket extends DatagramSocket
impl.leave(mcastaddr);
}
+/**
+ * Sends a packet of data to a multicast address with a TTL that is
+ * different from the default TTL on this socket. The default TTL for
+ * the socket is not changed.
+ *
+ * @param packet The packet of data to send
+ * @param ttl The TTL for this packet
+ *
+ * @exception IOException If an error occurs
+ */
public synchronized void send(DatagramPacket p, byte ttl) throws IOException
{
SecurityManager s = System.getSecurityManager();
@@ -123,4 +239,4 @@ public class MulticastSocket extends DatagramSocket
impl.send(p);
impl.setTimeToLive(oldttl);
}
-}
+} // class MulticastSocket