Commit f4f5d1d6 by Michael Koch Committed by Michael Koch

BufferedReader.java, [...]: Merged from classpath.

2003-03-18  Michael Koch  <konqueror@gmx.de>

	* java/io/BufferedReader.java,
	java/io/BufferedWriter.java,
	java/io/ByteArrayOutputStream.java,
	java/io/FileFilter.java,
	java/io/FilePermission.java,
	java/io/FileReader.java,
	java/io/FileWriter.java,
	java/io/FilenameFilter.java,
	java/io/FilterInputStream.java,
	java/io/FilterOutputStream.java,
	java/io/FilterReader.java,
	java/io/FilterWriter.java,
	java/io/ObjectInput.java,
	java/io/ObjectInputValidation.java,
	java/io/ObjectOutput.java,
	java/io/ObjectStreamField.java,
	java/io/PipedInputStream.java,
	java/io/PipedReader.java,
	java/io/PrintWriter.java,
	java/io/PushbackReader.java,
	java/io/Reader.java,
	java/io/SerializablePermission.java,
	java/io/StringReader.java,
	java/io/Writer.java:
	Merged from classpath.

From-SVN: r64525
parent 61f1ed59
2003-03-18 Michael Koch <konqueror@gmx.de>
* java/io/BufferedReader.java,
java/io/BufferedWriter.java,
java/io/ByteArrayOutputStream.java,
java/io/FileFilter.java,
java/io/FilePermission.java,
java/io/FileReader.java,
java/io/FileWriter.java,
java/io/FilenameFilter.java,
java/io/FilterInputStream.java,
java/io/FilterOutputStream.java,
java/io/FilterReader.java,
java/io/FilterWriter.java,
java/io/ObjectInput.java,
java/io/ObjectInputValidation.java,
java/io/ObjectOutput.java,
java/io/ObjectStreamField.java,
java/io/PipedInputStream.java,
java/io/PipedReader.java,
java/io/PrintWriter.java,
java/io/PushbackReader.java,
java/io/Reader.java,
java/io/SerializablePermission.java,
java/io/StringReader.java,
java/io/Writer.java:
Merged from classpath.
2003-03-17 Michael Koch <konqueror@gmx.de> 2003-03-17 Michael Koch <konqueror@gmx.de>
* java/awt/ScrollPaneAdjustable.java: * java/awt/ScrollPaneAdjustable.java:
......
...@@ -243,7 +243,8 @@ public class BufferedReader extends Reader ...@@ -243,7 +243,8 @@ public class BufferedReader extends Reader
* This method returns <code>false</code> then this stream could (but is * This method returns <code>false</code> then this stream could (but is
* not guaranteed to) block on the next read attempt. * not guaranteed to) block on the next read attempt.
* *
* @return <code>true</code> if this stream is ready to be read, <code>false</code> otherwise * @return <code>true</code> if this stream is ready to be read,
* <code>false</code> otherwise
* *
* @exception IOException If an error occurs * @exception IOException If an error occurs
*/ */
...@@ -258,7 +259,8 @@ public class BufferedReader extends Reader ...@@ -258,7 +259,8 @@ public class BufferedReader extends Reader
/** /**
* This method read chars from a stream and stores them into a caller * This method read chars from a stream and stores them into a caller
* supplied buffer. It starts storing the data at index <code>offset</code> into * supplied buffer. It starts storing the data at index
* <code>offset</code> into
* the buffer and attempts to read <code>len</code> chars. This method can * the buffer and attempts to read <code>len</code> chars. This method can
* return before reading the number of chars requested. The actual number * return before reading the number of chars requested. The actual number
* of chars read is returned as an int. A -1 is returned to indicate the * of chars read is returned as an int. A -1 is returned to indicate the
...@@ -473,7 +475,8 @@ public class BufferedReader extends Reader ...@@ -473,7 +475,8 @@ public class BufferedReader extends Reader
* requested amount. * requested amount.
* <p> * <p>
* This method first discards chars in the buffer, then calls the * This method first discards chars in the buffer, then calls the
* <code>skip</code> method on the underlying stream to skip the remaining chars. * <code>skip</code> method on the underlying stream to skip the
* remaining chars.
* *
* @param num_chars The requested number of chars to skip * @param num_chars The requested number of chars to skip
* *
......
...@@ -51,8 +51,6 @@ package java.io; ...@@ -51,8 +51,6 @@ package java.io;
* efficient mechanism for writing versus doing numerous small unbuffered * efficient mechanism for writing versus doing numerous small unbuffered
* writes. * writes.
* *
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@cygnus.com> * @author Tom Tromey <tromey@cygnus.com>
* @date September 25, 1998 * @date September 25, 1998
......
...@@ -65,8 +65,6 @@ package java.io; ...@@ -65,8 +65,6 @@ package java.io;
* application specified character encoding. Thus it can handle * application specified character encoding. Thus it can handle
* multibyte character encodings. * multibyte character encodings.
* *
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@cygnus.com> * @author Tom Tromey <tromey@cygnus.com>
* @date September 24, 1998 * @date September 24, 1998
......
...@@ -46,23 +46,21 @@ package java.io; ...@@ -46,23 +46,21 @@ package java.io;
* The method in this interface determines if a particular pathname should * The method in this interface determines if a particular pathname should
* or should not be included in the pathname listing. * or should not be included in the pathname listing.
* *
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public interface FileFilter public interface FileFilter
{ {
/** /**
* This method determines whether or not a given pathname should be included * This method determines whether or not a given pathname should be included
* in a pathname listing. * in a pathname listing.
* *
* @param pathname The pathname to test * @param pathname The pathname to test
* *
* @return <code>true</code> if the path should be included in the list, <code>false</code> otherwise. * @return <code>true</code> if the path should be included in the list,
*/ * <code>false</code> otherwise.
public abstract boolean */
accept(File pathname); public abstract boolean accept(File pathname);
} // interface FileFilter } // interface FileFilter
/* FileReader.java -- Convenience class for reading characters from a file /* FileReader.java -- Convenience class for reading characters from a file
Copyright (C) 1998, 2000 Free Software Foundation, Inc. Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -46,8 +46,6 @@ package java.io; ...@@ -46,8 +46,6 @@ package java.io;
* to read from files using the default character encoding. Use * to read from files using the default character encoding. Use
* <code>InputStreamReader</code> directly to use a non-default encoding. * <code>InputStreamReader</code> directly to use a non-default encoding.
* *
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public class FileReader extends InputStreamReader public class FileReader extends InputStreamReader
...@@ -90,4 +88,5 @@ public class FileReader extends InputStreamReader ...@@ -90,4 +88,5 @@ public class FileReader extends InputStreamReader
{ {
super(new FileInputStream(name)); super(new FileInputStream(name));
} }
} } // class FileReader
...@@ -54,84 +54,82 @@ package java.io; ...@@ -54,84 +54,82 @@ package java.io;
public class FileWriter extends OutputStreamWriter public class FileWriter extends OutputStreamWriter
{ {
/*************************************************************************/ /*************************************************************************/
/* /*
* Constructors * Constructors
*/ */
/** /**
* This method initializes a new <code>FileWriter</code> object to write * This method initializes a new <code>FileWriter</code> object to write
* to the specified <code>File</code> object. * to the specified <code>File</code> object.
* *
* @param file The <code>File</code> object to write to. * @param file The <code>File</code> object to write to.
* *
* @param SecurityException If writing to this file is forbidden by the * @param SecurityException If writing to this file is forbidden by the
* <code>SecurityManager</code>. * <code>SecurityManager</code>.
* @param IOException If any other error occurs * @param IOException If any other error occurs
*/ */
public public FileWriter(File file) throws SecurityException, IOException
FileWriter(File file) throws SecurityException, IOException {
{ super(new FileOutputStream(file));
super(new FileOutputStream(file)); }
}
/*************************************************************************/
/*************************************************************************/
/**
/** * This method initializes a new <code>FileWriter</code> object to write
* This method initializes a new <code>FileWriter</code> object to write * to the specified <code>FileDescriptor</code> object.
* to the specified <code>FileDescriptor</code> object. *
* * @param fd The <code>FileDescriptor</code> object to write to
* @param fd The <code>FileDescriptor</code> object to write to *
* * @param SecurityException If writing to this file is forbidden by the
* @param SecurityException If writing to this file is forbidden by the * <code>SecurityManager</code>.
* <code>SecurityManager</code>. */
*/ public FileWriter(FileDescriptor fd) throws SecurityException
public {
FileWriter(FileDescriptor fd) throws SecurityException super(new FileOutputStream(fd));
{ }
super(new FileOutputStream(fd));
} /*************************************************************************/
/*************************************************************************/ /**
* This method intializes a new <code>FileWriter</code> object to
/** * write to the
* This method intializes a new <code>FileWriter</code> object to write to the * specified named file.
* specified named file. *
* * @param name The name of the file to write to
* @param name The name of the file to write to *
* * @param SecurityException If writing to this file is forbidden by the
* @param SecurityException If writing to this file is forbidden by the * <code>SecurityManager</code>.
* <code>SecurityManager</code>. * @param IOException If any other error occurs
* @param IOException If any other error occurs */
*/ public FileWriter(String name) throws IOException
public {
FileWriter(String name) throws IOException super(new FileOutputStream(name));
{ }
super(new FileOutputStream(name));
} /*************************************************************************/
/*************************************************************************/ /**
* This method intializes a new <code>FileWriter</code> object to
/** * write to the
* This method intializes a new <code>FileWriter</code> object to write to the * specified named file. This form of the constructor allows the caller
* specified named file. This form of the constructor allows the caller * to determin whether data should be written starting at the beginning or
* to determin whether data should be written starting at the beginning or * the end of the file.
* the end of the file. *
* * @param name The name of the file to write to
* @param name The name of the file to write to * @param append <code>true</code> to start adding data at the end of the
* @param append <code>true</code> to start adding data at the end of the * file, <code>false</code> otherwise.
* file, <code>false</code> otherwise. *
* * @param SecurityException If writing to this file is forbidden by the
* @param SecurityException If writing to this file is forbidden by the * <code>SecurityManager</code>.
* <code>SecurityManager</code>. * @param IOException If any other error occurs
* @param IOException If any other error occurs */
*/ public FileWriter(String name, boolean append) throws IOException
public {
FileWriter(String name, boolean append) throws IOException super(new FileOutputStream(name, append));
{ }
super(new FileOutputStream(name, append));
}
} // class FileWriter } // class FileWriter
...@@ -57,17 +57,17 @@ package java.io; ...@@ -57,17 +57,17 @@ package java.io;
public interface FilenameFilter public interface FilenameFilter
{ {
/** /**
* This method determines whether or not a given file should be included * This method determines whether or not a given file should be included
* in a directory listing. * in a directory listing.
* *
* @param dir The <code>File</code> instance for the directory being read * @param dir The <code>File</code> instance for the directory being read
* @param name The name of the file to test * @param name The name of the file to test
* *
* @return <code>true</code> if the file should be included in the list, * @return <code>true</code> if the file should be included in the list,
* <code>false</code> otherwise. * <code>false</code> otherwise.
*/ */
boolean boolean accept(File dir, String name);
accept(File dir, String name);
} // interface FilenameFilter } // interface FilenameFilter
...@@ -70,179 +70,171 @@ package java.io; ...@@ -70,179 +70,171 @@ package java.io;
public class FilterInputStream extends InputStream public class FilterInputStream extends InputStream
{ {
/*************************************************************************/ /*************************************************************************/
/* /*
* Instance Variables * Instance Variables
*/ */
/** /**
* This is the subordinate <code>InputStream</code> to which method calls * This is the subordinate <code>InputStream</code> to which method calls
* are redirected * are redirected
*/ */
protected InputStream in; protected InputStream in;
/*************************************************************************/ /*************************************************************************/
/* /*
* Constructors * Constructors
*/ */
/** /**
* Create a <code>FilterInputStream</code> with the specified subordinate * Create a <code>FilterInputStream</code> with the specified subordinate
* <code>InputStream</code>. * <code>InputStream</code>.
* *
* @param in The subordinate <code>InputStream</code> * @param in The subordinate <code>InputStream</code>
*/ */
protected protected FilterInputStream(InputStream in)
FilterInputStream(InputStream in) {
{ this.in = in;
this.in = in; }
}
/*************************************************************************/
/*************************************************************************/
/*
/* * Instance Methods
* Instance Methods */
*/
/**
/** * Calls the <code>in.mark(int)</code> method.
* Calls the <code>in.mark(int)</code> method. *
* * @param readlimit The parameter passed to <code>in.mark(int)</code>
* @param readlimit The parameter passed to <code>in.mark(int)</code> */
*/ public void mark(int readlimit)
public void {
mark(int readlimit) in.mark(readlimit);
{ }
in.mark(readlimit);
} /*************************************************************************/
/*************************************************************************/ /**
* Calls the <code>in.markSupported()</code> method.
/** *
* Calls the <code>in.markSupported()</code> method. * @return <code>true</code> if mark/reset is supported, <code>false</code>
* * otherwise
* @return <code>true</code> if mark/reset is supported, <code>false</code> */
* otherwise public boolean markSupported()
*/ {
public boolean return(in.markSupported());
markSupported() }
{
return(in.markSupported()); /*************************************************************************/
}
/**
/*************************************************************************/ * Calls the <code>in.reset()</code> method.
*
/** * @exception IOException If an error occurs
* Calls the <code>in.reset()</code> method. */
* public void reset() throws IOException
* @exception IOException If an error occurs {
*/ in.reset();
public void }
reset() throws IOException
{ /*************************************************************************/
in.reset();
} /**
* Calls the <code>in.available()</code> method.
/*************************************************************************/ *
* @return The value returned from <code>in.available()</code>
/** *
* Calls the <code>in.available()</code> method. * @exception IOException If an error occurs
* */
* @return The value returned from <code>in.available()</code> public int available() throws IOException
* {
* @exception IOException If an error occurs return(in.available());
*/ }
public int
available() throws IOException /*************************************************************************/
{
return(in.available()); /**
} * Calls the <code>in.skip(long)</code> method
*
/*************************************************************************/ * @param numBytes The requested number of bytes to skip.
*
/** * @return The value returned from <code>in.skip(long)</code>
* Calls the <code>in.skip(long)</code> method *
* * @exception IOException If an error occurs
* @param The requested number of bytes to skip. */
* public long skip(long num_bytes) throws IOException
* @return The value returned from <code>in.skip(long)</code> {
* return(in.skip(num_bytes));
* @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
/** */
* Calls the <code>in.read()</code> method public int read() throws IOException
* {
* @return The value returned from <code>in.read()</code> return(in.read());
* }
* @exception IOException If an error occurs
*/ /*************************************************************************/
public int
read() throws IOException /**
{ * Calls the <code>read(byte[], int, int)</code> overloaded method.
return(in.read()); * 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
* Calls the <code>read(byte[], int, int)</code> overloaded method. Note that *
* this method does not redirect its call directly to a corresponding * @return The value retured from <code>in.read(byte[], int, int)</code>
* method in <code>in</code>. This allows subclasses to override only the *
* three argument version of <code>read</code>. * @exception IOException If an error occurs
* */
* @param buf The buffer to read bytes into public int read(byte[] buf) throws IOException
* {
* @return The value retured from <code>in.read(byte[], int, int)</code> return(read(buf, 0, buf.length));
* }
* @exception IOException If an error occurs
*/ /*************************************************************************/
public int
read(byte[] buf) throws IOException /**
{ * Calls the <code>in.read(byte[], int, int)</code> method.
return(read(buf, 0, buf.length)); *
} * @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>
* Calls the <code>in.read(byte[], int, int)</code> method. *
* * @exception IOException If an error occurs
* @param buf The buffer to read bytes into */
* @param offset The index into the buffer to start storing bytes public int read(byte[] buf, int offset, int len) throws IOException
* @param len The maximum number of bytes to read. {
* return(in.read(buf, offset, len));
* @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 * This method closes the input stream by closing the input stream that
{ * this object is filtering. Future attempts to access this stream may
return(in.read(buf, offset, len)); * throw an exception.
} *
* @exception IOException If an error occurs
/*************************************************************************/ */
public void close() throws IOException
/** {
* This method closes the input stream by closing the input stream that in.close();
* 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 } // class FilterInputStream
/* FilterOutputStream.java -- Parent class for output streams that filter /* FilterOutputStream.java -- Parent class for output streams that filter
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -57,126 +57,121 @@ package java.io; ...@@ -57,126 +57,121 @@ package java.io;
public class FilterOutputStream extends OutputStream public class FilterOutputStream extends OutputStream
{ {
/*************************************************************************/ /*************************************************************************/
/* /*
* Instance Variables * Instance Variables
*/ */
/** /**
* This is the subordinate <code>OutputStream</code> that this class * This is the subordinate <code>OutputStream</code> that this class
* redirects its method calls to. * redirects its method calls to.
*/ */
protected OutputStream out; protected OutputStream out;
/*************************************************************************/ /*************************************************************************/
/* /*
* Constructors * Constructors
*/ */
/** /**
* This method initializes an instance of <code>FilterOutputStream</code> * This method initializes an instance of <code>FilterOutputStream</code>
* to write to the specified subordinate <code>OutputStream</code>. * to write to the specified subordinate <code>OutputStream</code>.
* *
* @param out The <code>OutputStream</code> to write to * @param out The <code>OutputStream</code> to write to
*/ */
public public FilterOutputStream(OutputStream out)
FilterOutputStream(OutputStream out) {
{ this.out = out;
this.out = out; }
}
/*************************************************************************/
/*************************************************************************/
/*
/* * Instance Methods
* Instance Methods */
*/
/**
/** * This method closes the underlying <code>OutputStream</code>. Any
* This method closes the underlying <code>OutputStream</code>. Any * further attempts to write to this stream may throw an exception.
* further attempts to write to this stream may throw an exception. *
* * @exception IOException If an error occurs
* @exception IOException If an error occurs */
*/ public void close() throws IOException
public void {
close() throws IOException flush();
{ out.close();
flush(); }
out.close();
} /*************************************************************************/
/*************************************************************************/ /**
* This method attempt to flush all buffered output to be written to the
/** * underlying output sink.
* This method attempt to flush all buffered output to be written to the *
* underlying output sink. * @exception IOException If an error occurs
* */
* @exception IOException If an error occurs public void flush() throws IOException
*/ {
public void out.flush();
flush() throws IOException }
{
out.flush(); /*************************************************************************/
}
/**
/*************************************************************************/ * This method writes a single byte of output to the underlying
* <code>OutputStream</code>.
/** *
* This method writes a single byte of output to the underlying * @param b The byte to write, passed as an int.
* <code>OutputStream</code>. *
* * @exception IOException If an error occurs
* @param b The byte to write, passed as an int. */
* public void write(int b) throws IOException
* @exception IOException If an error occurs {
*/ out.write(b);
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>
* This method writes all the bytes in the specified array to the underlying * directly. This allows most subclasses to avoid overriding this method.
* <code>OutputStream</code>. It does this by calling the three parameter *
* version of this method - <code>write(byte[], int, int)</code> in this * @param buf The byte array to write bytes from
* class instead of writing to the underlying <code>OutputStream</code> *
* directly. This allows most subclasses to avoid overriding this method. * @exception IOException If an error occurs
* */
* @param buf The byte array to write bytes from public void write(byte[] buf) throws IOException
* {
* @exception IOException If an error occurs // Don't do checking here, per Java Lang Spec.
*/ write(buf, 0, buf.length);
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.
/** *
* This method calls the <code>write(int)</code> method <code>len</code> * @param buf The byte array to write bytes from
* times for all bytes from the array <code>buf</code> starting at index * @param offset The index into the array to start writing bytes from
* <code>offset</code>. Subclasses should overwrite this method to get a * @param len The number of bytes to write
* more efficient implementation. *
* * @exception IOException If an error occurs
* @param buf The byte array to write bytes from */
* @param offset The index into the array to start writing bytes from public void write(byte[] buf, int offset, int len) throws IOException
* @param len The number of bytes to write {
* // Don't do checking here, per Java Lang Spec.
* @exception IOException If an error occurs for (int i=0; i < len; i++)
*/ write(buf[offset + i]);
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 } // class FilterOutputStream
/* FilterReader.java -- Base class for char stream classes that filter input /* FilterReader.java -- Base class for char stream classes that filter input
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -63,163 +63,153 @@ package java.io; ...@@ -63,163 +63,153 @@ package java.io;
*/ */
public abstract class FilterReader extends Reader public abstract class FilterReader extends Reader
{ {
/*
/*************************************************************************/ * Instance Variables
*/
/*
* Instance Variables /**
*/ * This is the subordinate <code>Reader</code> to which method calls
* are redirected
/** */
* This is the subordinate <code>Reader</code> to which method calls protected Reader in;
* are redirected
*/ /*************************************************************************/
protected Reader in;
/*
/*************************************************************************/ * Constructors
*/
/*
* 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
* Create a <code>FilterReader</code> with the specified subordinate * to <code>in.lock</code>.
* <code>Reader</code>. *
* The <code>lock</code> of the new <code>FilterReader</code> will be set * @param in The subordinate <code>Reader</code>
* to <code>in.lock</code>. */
* protected FilterReader(Reader in)
* @param in The subordinate <code>Reader</code> {
*/ super(in.lock);
protected this.in = in;
FilterReader(Reader in) }
{
super(in.lock); /*************************************************************************/
this.in = in;
} /*
* Instance Methods
/*************************************************************************/ */
/* /**
* Instance Methods * Calls the <code>in.mark(int)</code> method.
*/ *
* @param readlimit The parameter passed to <code>in.mark(int)</code>
/** *
* Calls the <code>in.mark(int)</code> method. * @exception IOException If an error occurs
* */
* @param readlimit The parameter passed to <code>in.mark(int)</code> public void mark(int readlimit) throws IOException
* {
* @exception IOException If an error occurs in.mark(readlimit);
*/ }
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
/** */
* Calls the <code>in.markSupported()</code> method. public boolean markSupported()
* {
* @return <code>true</code> if mark/reset is supported, <code>false</code> otherwise return(in.markSupported());
*/ }
public boolean
markSupported() /*************************************************************************/
{
return(in.markSupported()); /**
} * Calls the <code>in.reset()</code> method.
*
/*************************************************************************/ * @exception IOException If an error occurs
*/
/** public void reset() throws IOException
* Calls the <code>in.reset()</code> method. {
* in.reset();
* @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
/** */
* Calls the <code>in.read()</code> method. public boolean ready() throws IOException
* {
* @return The value returned from <code>in.available()</code> return(in.ready());
* }
* @exception IOException If an error occurs
*/ /*************************************************************************/
public boolean
ready() throws IOException /**
{ * Calls the <code>in.skip(long)</code> method
return(in.ready()); *
} * @param numBytes The requested number of chars to skip.
*
/*************************************************************************/ * @return The value returned from <code>in.skip(long)</code>
*
/** * @exception IOException If an error occurs
* Calls the <code>in.skip(long)</code> method */
* public long skip(long num_chars) throws IOException
* @param The requested number of chars to skip. {
* return(in.skip(num_chars));
* @return The value returned from <code>in.skip(long)</code> }
*
* @exception IOException If an error occurs /*************************************************************************/
*/
public long /**
skip(long num_chars) throws IOException * Calls the <code>in.read()</code> method
{ *
return(in.skip(num_chars)); * @return The value returned from <code>in.read()</code>
} *
* @exception IOException If an error occurs
/*************************************************************************/ */
public int read() throws IOException
/** {
* Calls the <code>in.read()</code> method return(in.read());
* }
* @return The value returned from <code>in.read()</code>
* /*************************************************************************/
* @exception IOException If an error occurs
*/ /**
public int * Calls the <code>in.read(char[], int, int)</code> method.
read() throws IOException *
{ * @param buf The buffer to read chars into
return(in.read()); * @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
* Calls the <code>in.read(char[], int, int)</code> method. */
* public int read(char[] buf, int offset, int len) throws IOException
* @param buf The buffer to read chars into {
* @param offset The index into the buffer to start storing chars return(in.read(buf, offset, len));
* @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 /**
*/ * This method closes the stream by calling the <code>close()</code> method
public int * of the underlying stream.
read(char[] buf, int offset, int len) throws IOException *
{ * @exception IOException If an error occurs
return(in.read(buf, offset, len)); */
} public void close() throws IOException
{
/*************************************************************************/ in.close();
}
/**
* 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 } // class FilterReader
/* FilterWriter.java -- Parent class for output streams that filter /* FilterWriter.java -- Parent class for output streams that filter
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -52,128 +52,120 @@ package java.io; ...@@ -52,128 +52,120 @@ package java.io;
* underlying stream. Subclasses provide actual filtering. * underlying stream. Subclasses provide actual filtering.
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@cygnus.com> * @author Tom Tromey <tromey@cygnus.com>
*/ */
public abstract class FilterWriter extends Writer public abstract class FilterWriter extends Writer
{ {
/*
/*************************************************************************/ * Instance Variables
*/
/*
* Instance Variables /**
*/ * This is the subordinate <code>Writer</code> that this class
* redirects its method calls to.
/** */
* This is the subordinate <code>Writer</code> that this class protected Writer out;
* redirects its method calls to.
*/ /*************************************************************************/
protected Writer out;
/*
/*************************************************************************/ * Constructors
*/
/*
* 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
* This method initializes an instance of <code>FilterWriter</code> * the newly created <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 * @param out The <code>Writer</code> to write to
* the newly created <code>FilterWriter</code>. */
* protected FilterWriter(Writer out)
* @param out The <code>Writer</code> to write to {
*/ super(out);
protected this.out = out;
FilterWriter(Writer out) }
{
super(out); /*************************************************************************/
this.out = out;
} /*
* Instance Methods
/*************************************************************************/ */
/* /**
* 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
* This method closes the underlying <code>Writer</code>. Any */
* further attempts to write to this stream may throw an exception. public void close() throws IOException
* {
* @exception IOException If an error occurs out.close();
*/ }
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
/** */
* This method attempt to flush all buffered output to be written to the public void flush() throws IOException
* underlying output sink. {
* out.flush();
* @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
* This method writes a single char of output to the underlying */
* <code>Writer</code>. public void write(int b) throws IOException
* {
* @param b The char to write, passed as an int. out.write(b);
* }
* @exception IOException If an error occurs
*/ /*************************************************************************/
public void
write(int b) throws IOException /**
{ * This method writes <code>len</code> chars from the array <code>buf</code>
out.write(b); * 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
* This method writes <code>len</code> chars from the array <code>buf</code> *
* starting at index <code>offset</code> to the underlying * @exception IOException If an error occurs
* <code>Writer</code>. */
* public void write(char[] buf, int offset, int len) throws IOException
* @param buf The char array to write chars from {
* @param offset The index into the array to start writing chars from out.write(buf, offset, len);
* @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 * This method writes <code>len</code> chars from the <code>String</code>
{ * starting at position <code>offset</code>.
out.write(buf, offset, len); *
} * @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
/** *
* This method writes <code>len</code> chars from the <code>String</code> * @exception IOException If an error occurs
* starting at position <code>offset</code>. */
* public void write(String str, int offset, int len) throws IOException
* @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 out.write(str, offset, len);
* @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 } // class FilterWriter
/* ObjectInput.java -- Read object data from a stream /* ObjectInput.java -- Read object data from a stream
Copyright (C) 1998 Free Software Foundation, Inc. Copyright (C) 1998,2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -44,115 +44,108 @@ package java.io; ...@@ -44,115 +44,108 @@ package java.io;
* also has methods that allow input to be done in a manner similar to * also has methods that allow input to be done in a manner similar to
* <code>InputStream</code> * <code>InputStream</code>
* *
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public interface ObjectInput extends DataInput public interface ObjectInput extends DataInput
{ {
/**
/** * This method returns the number of bytes that can be read without
* This method returns the number of bytes that can be read without * blocking.
* blocking. *
* * @return The number of bytes available before blocking
* @return The number of bytes available before blocking *
* * @exception IOException If an error occurs
* @exception IOException If an error occurs */
*/ public abstract int available() throws IOException;
public abstract int
available() throws IOException; /*************************************************************************/
/*************************************************************************/ /**
* This method reading a byte of data from a stream. It returns that byte
/** * as an int. This method blocks if no data is available to be read.
* This method reading a byte of data from a stream. It returns that byte *
* as an int. This method blocks if no data is available to be read. * @return The byte of data read
* *
* @return The byte of data read * @exception IOException If an error occurs
* */
* @exception IOException If an error occurs public abstract int read() throws IOException;
*/
public abstract int /*************************************************************************/
read() throws IOException;
/**
/*************************************************************************/ * This method reads raw bytes and stores them them a byte array buffer.
* Note that this method will block if no data is available. However,
/** * it will not necessarily block until it fills the entire buffer. That is,
* This method reads raw bytes and stores them them a byte array buffer. * a "short count" is possible.
* Note that this method will block if no data is available. However, *
* it will not necessarily block until it fills the entire buffer. That is, * @param buf The byte array to receive the data read
* a "short count" is possible. *
* * @return The actual number fo bytes read or -1 if end of stream
* @param buf The byte array to receive the data read *
* * @exception IOException If an error occurs
* @return The actual number fo bytes read or -1 if end of stream */
* public abstract int read(byte[] buf) throws IOException;
* @exception IOException If an error occurs
*/ /*************************************************************************/
public abstract int
read(byte[] buf) throws IOException; /**
* This method reads raw bytes and stores them in a byte array buffer
/*************************************************************************/ * <code>buf</code> starting at position <code>offset</code> into the
* buffer. A
/** * maximum of <code>len</code> bytes will be read. Note that this method
* This method reads raw bytes and stores them in a byte array buffer * blocks if no data is available, but will not necessarily block until
* <code>buf</code> starting at position <code>offset</code> into the buffer. A * it can read <code>len</code> bytes of data. That is, a "short count" is
* maximum of <code>len</code> bytes will be read. Note that this method * possible.
* blocks if no data is available, but will not necessarily block until *
* it can read <code>len</code> bytes of data. That is, a "short count" is * @param buf The byte array to receive the data read
* possible. * @param offset The offset into @code{buf} to start storing data
* * @param len The maximum number of bytes to read
* @param buf The byte array to receive the data read *
* @param offset The offset into @code{buf} to start storing data * @return The actual number fo bytes read or -1 if end of stream
* @param len The maximum number of bytes to read *
* * @exception IOException If an error occurs
* @return The actual number fo bytes read or -1 if end of stream */
* public abstract int read(byte[] buf, int offset, int len) throws IOException;
* @exception IOException If an error occurs
*/ /*************************************************************************/
public abstract int
read(byte[] buf, int offset, int len) throws IOException; /**
* Reads an object instance and returns it. If the class for the object
/*************************************************************************/ * being read cannot be found, then a ClassNotFoundException will
* be thrown.
/** *
* Reads an object instance and returns it. If the class for the object * @return The object instance that was read
* being read cannot be found, then a ClassNotFoundException will *
* be thrown. * @exception ClassNotFoundException If a class for the object cannot be
* * found
* @return The object instance that was read * @exception IOException If an error occurs
* */
* @exception ClassNotFoundException If a class for the object cannot be found public abstract Object readObject()
* @exception IOException If an error occurs throws ClassNotFoundException, IOException;
*/
public abstract Object /*************************************************************************/
readObject() throws ClassNotFoundException, IOException;
/**
/*************************************************************************/ * This method causes the specified number of bytes to be read and
* discarded. It is possible that fewer than the requested number of bytes
/** * will actually be skipped.
* This method causes the specified number of bytes to be read and *
* discarded. It is possible that fewer than the requested number of bytes * @param numBytes The number of bytes to skip
* will actually be skipped. *
* * @return The actual number of bytes skipped
* @param num_bytes The number of bytes to skip *
* * @exception IOException If an error occurs
* @return The actual number of bytes skipped */
* public abstract long skip(long num_bytes) throws IOException;
* @exception IOException If an error occurs
*/ /*************************************************************************/
public abstract long
skip(long num_bytes) throws IOException; /**
* This method closes the input source
/*************************************************************************/ *
* @exception IOException If an error occurs
/** */
* This method closes the input source public abstract void close() throws IOException;
*
* @exception IOException If an error occurs
*/
public abstract void
close() throws IOException;
} // interface ObjectInput } // interface ObjectInput
/* ObjectInputValidation.java -- Validate an object /* ObjectInputValidation.java -- Validate an object
Copyright (C) 1998 Free Software Foundation, Inc. Copyright (C) 1998, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -41,21 +41,18 @@ package java.io; ...@@ -41,21 +41,18 @@ package java.io;
/** /**
* What does this interface really do? * What does this interface really do?
* *
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public interface ObjectInputValidation public interface ObjectInputValidation
{ {
/** /**
* This method is called to validate an object. If the object is invalid * This method is called to validate an object. If the object is invalid
* an exception is thrown. * an exception is thrown.
* *
* @exception InvalidObjectException If the object is invalid * @exception InvalidObjectException If the object is invalid
*/ */
public abstract void public abstract void validateObject() throws InvalidObjectException;
validateObject() throws InvalidObjectException;
} // interface ObjectInputValidation } // interface ObjectInputValidation
/* ObjectOutput.java -- Interface for writing objects to a stream /* ObjectOutput.java -- Interface for writing objects to a stream
Copyright (C) 1998 Free Software Foundation, Inc. Copyright (C) 1998, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -41,87 +41,80 @@ package java.io; ...@@ -41,87 +41,80 @@ package java.io;
/** /**
* This interface extends <code>DataOutput</code> to provide the additional * This interface extends <code>DataOutput</code> to provide the additional
* facility of writing object instances to a stream. It also adds some * facility of writing object instances to a stream. It also adds some
* additional methods to make the interface more <code>OutputStream</code> like. * additional methods to make the interface more
* * <code>OutputStream</code> like.
* @version 0.0
* *
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public interface ObjectOutput extends DataOutput public interface ObjectOutput extends DataOutput
{ {
/**
/** * This method writes the specified byte to the output stream.
* This method writes the specified byte to the output stream. *
* * @param b The byte to write.
* @param b The byte to write. *
* * @exception IOException If an error occurs.
* @exception IOException If an error occurs. */
*/ public abstract void write(int b) throws IOException;
public abstract void
write(int b) throws IOException; /*************************************************************************/
/*************************************************************************/ /**
* This method writes all the bytes in the specified byte array to the
/** * output stream.
* This method writes all the bytes in the specified byte array to the *
* output stream. * @param buf The array of bytes to write.
* *
* @param buf The array of bytes to write. * @exception IOException If an error occurs.
* */
* @exception IOException If an error occurs. public abstract void write(byte[] buf) throws IOException;
*/
public abstract void /*************************************************************************/
write(byte[] buf) throws IOException;
/**
/*************************************************************************/ * This method writes <code>len</code> bytes from the specified array
* starting at index <code>offset</code> into that array.
/** *
* This method writes <code>len</code> bytes from the specified array * @param buf The byte array to write from.
* starting at index <code>offset</code> into that array. * @param offset The index into the byte array to start writing from.
* * @param len The number of bytes to write.
* @param buf The byte array to write from. *
* @param offset The index into the byte array to start writing from. * @exception IOException If an error occurs.
* @param len The number of bytes to write. */
* public abstract void write(byte[] buf, int offset, int len)
* @exception IOException If an error occurs. throws IOException;
*/
public abstract void /*************************************************************************/
write(byte[] buf, int offset, int len) throws IOException;
/**
/*************************************************************************/ * This method writes a object instance to a stream. The format of the
* data written is determined by the actual implementation of this method
/** *
* This method writes a object instance to a stream. The format of the * @param obj The object to write
* data written is determined by the actual implementation of this method *
* * @exception IOException If an error occurs
* @param obj The object to write */
* public abstract void writeObject(Object obj) throws IOException;
* @exception IOException If an error occurs
*/ /*************************************************************************/
public abstract void
writeObject(Object obj) throws IOException; /**
* This method causes any buffered data to be flushed out to the underlying
/*************************************************************************/ * stream
*
/** * @exception IOException If an error occurs
* This method causes any buffered data to be flushed out to the underlying */
* stream public abstract void flush() throws IOException;
*
* @exception IOException If an error occurs /*************************************************************************/
*/
public abstract void /**
flush() throws IOException; * This method closes the underlying stream.
*
/*************************************************************************/ * @exception IOException If an error occurs
*/
/** public abstract void close() throws IOException;
* This method closes the underlying stream.
*
* @exception IOException If an error occurs
*/
public abstract void
close() throws IOException;
} // interface ObjectOutput } // interface ObjectOutput
/* ObjectStreamField.java -- Class used to store name and class of fields /* ObjectStreamField.java -- Class used to store name and class of fields
Copyright (C) 1998, 1999 Free Software Foundation, Inc. Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -51,17 +51,21 @@ public class ObjectStreamField implements java.lang.Comparable ...@@ -51,17 +51,21 @@ public class ObjectStreamField implements java.lang.Comparable
} }
/** /**
* There're many cases you can't get java.lang.Class from typename if your context * There're many cases you can't get java.lang.Class from typename
* if your context
* class loader can't load it, then use typename to construct the field * class loader can't load it, then use typename to construct the field
*/ */
ObjectStreamField (String name, String typename){ ObjectStreamField (String name, String typename){
this.name = name; this.name = name;
this.typename = typename; this.typename = typename;
try{ try
type = TypeSignature.getClassForEncoding(typename); {
}catch(ClassNotFoundException e){ type = TypeSignature.getClassForEncoding(typename);
type = Object.class; //?? }
} catch(ClassNotFoundException e)
{
type = Object.class; //FIXME: ???
}
} }
public String getName () public String getName ()
...@@ -125,3 +129,4 @@ public class ObjectStreamField implements java.lang.Comparable ...@@ -125,3 +129,4 @@ public class ObjectStreamField implements java.lang.Comparable
private String typename; private String typename;
private int offset = -1; // XXX make sure this is correct private int offset = -1; // XXX make sure this is correct
} }
/* PipedInputStream.java -- Read portion of piped streams. /* PipedInputStream.java -- Read portion of piped streams.
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -46,7 +46,8 @@ package java.io; ...@@ -46,7 +46,8 @@ package java.io;
* to which it is connected. * to which it is connected.
* <p> * <p>
* Data is read and written to an internal buffer. It is highly recommended * Data is read and written to an internal buffer. It is highly recommended
* that the <code>PipedInputStream</code> and connected <code>PipedOutputStream</code> * that the <code>PipedInputStream</code> and connected
* <code>PipedOutputStream</code>
* be part of different threads. If they are not, the read and write * be part of different threads. If they are not, the read and write
* operations could deadlock their thread. * operations could deadlock their thread.
* *
...@@ -113,7 +114,8 @@ public class PipedInputStream extends InputStream ...@@ -113,7 +114,8 @@ public class PipedInputStream extends InputStream
* it to the passed in <code>PipedOutputStream</code>. The stream is then * it to the passed in <code>PipedOutputStream</code>. The stream is then
* ready for reading. * ready for reading.
* *
* @param source The <code>PipedOutputStream</code> to connect this stream to * @param source The <code>PipedOutputStream</code> to connect this
* stream to
* *
* @exception IOException If <code>source</code> is already connected. * @exception IOException If <code>source</code> is already connected.
*/ */
...@@ -123,7 +125,8 @@ public class PipedInputStream extends InputStream ...@@ -123,7 +125,8 @@ public class PipedInputStream extends InputStream
} }
/** /**
* This method connects this stream to the passed in <code>PipedOutputStream</code>. * This method connects this stream to the passed in
* <code>PipedOutputStream</code>.
* This stream is then ready for reading. If this stream is already * This stream is then ready for reading. If this stream is already
* connected or has been previously closed, then an exception is thrown * connected or has been previously closed, then an exception is thrown
* *
...@@ -224,9 +227,12 @@ public class PipedInputStream extends InputStream ...@@ -224,9 +227,12 @@ public class PipedInputStream extends InputStream
/** /**
* This method reads bytes from the stream into a caller supplied buffer. * This method reads bytes from the stream into a caller supplied buffer.
* It starts storing bytes at position <code>offset</code> into the buffer and * It starts storing bytes at position <code>offset</code> into the
* reads a maximum of <code>len</code> bytes. Note that this method can actually * buffer and
* read fewer than <code>len</code> bytes. The actual number of bytes read is * reads a maximum of <code>len</code> bytes. Note that this method
* can actually
* read fewer than <code>len</code> bytes. The actual number of bytes
* read is
* returned. A -1 is returned to indicated that no bytes can be read * returned. A -1 is returned to indicated that no bytes can be read
* because the end of the stream was reached. If the stream is already * because the end of the stream was reached. If the stream is already
* closed, a -1 will again be returned to indicate the end of the stream. * closed, a -1 will again be returned to indicate the end of the stream.
...@@ -255,9 +261,12 @@ public class PipedInputStream extends InputStream ...@@ -255,9 +261,12 @@ public class PipedInputStream extends InputStream
/** /**
* This method reads bytes from the stream into a caller supplied buffer. * This method reads bytes from the stream into a caller supplied buffer.
* It starts storing bytes at position <code>offset</code> into the buffer and * It starts storing bytes at position <code>offset</code> into the
* reads a maximum of <code>len</code> bytes. Note that this method can actually * buffer and
* read fewer than <code>len</code> bytes. The actual number of bytes read is * reads a maximum of <code>len</code> bytes. Note that this method
* can actually
* read fewer than <code>len</code> bytes. The actual number of bytes
* read is
* returned. A -1 is returned to indicated that no bytes can be read * returned. A -1 is returned to indicated that no bytes can be read
* because the end of the stream was reached - ie close() was called on the * because the end of the stream was reached - ie close() was called on the
* connected PipedOutputStream. * connected PipedOutputStream.
...@@ -371,3 +380,4 @@ public class PipedInputStream extends InputStream ...@@ -371,3 +380,4 @@ public class PipedInputStream extends InputStream
notifyAll(); notifyAll();
} }
} }
...@@ -118,7 +118,8 @@ public class PipedReader extends Reader ...@@ -118,7 +118,8 @@ public class PipedReader extends Reader
} }
/** /**
* This method connects this stream to the passed in <code>PipedWriter</code>. * This method connects this stream to the passed in
* <code>PipedWriter</code>.
* This stream is then ready for reading. If this stream is already * This stream is then ready for reading. If this stream is already
* connected or has been previously closed, then an exception is thrown * connected or has been previously closed, then an exception is thrown
* *
...@@ -207,9 +208,12 @@ public class PipedReader extends Reader ...@@ -207,9 +208,12 @@ public class PipedReader extends Reader
/** /**
* This method reads chars from the stream into a caller supplied buffer. * This method reads chars from the stream into a caller supplied buffer.
* It starts storing chars at position <code>offset</code> into the buffer and * It starts storing chars at position <code>offset</code> into the
* reads a maximum of <code>len</code> chars. Note that this method can actually * buffer and
* read fewer than <code>len</code> chars. The actual number of chars read is * reads a maximum of <code>len</code> chars. Note that this method
* can actually
* read fewer than <code>len</code> chars. The actual number of chars
* read is
* returned. A -1 is returned to indicated that no chars can be read * returned. A -1 is returned to indicated that no chars can be read
* because the end of the stream was reached. If the stream is already * because the end of the stream was reached. If the stream is already
* closed, a -1 will again be returned to indicate the end of the stream. * closed, a -1 will again be returned to indicate the end of the stream.
...@@ -237,10 +241,11 @@ public class PipedReader extends Reader ...@@ -237,10 +241,11 @@ public class PipedReader extends Reader
} }
/** /**
* This method reads characters from the stream into a caller supplied buffer. * This method reads characters from the stream into a caller supplied
* It starts storing chars at position <code>offset</code> into the buffer and * buffer. It starts storing chars at position <code>offset</code> into
* reads a maximum of <code>len</code> chars. Note that this method can actually * the buffer and reads a maximum of <code>len</code> chars. Note that
* read fewer than <code>len</code> chars. The actual number of chars read is * this method can actually read fewer than <code>len</code> chars.
* The actual number of chars read is
* returned. A -1 is returned to indicated that no chars can be read * returned. A -1 is returned to indicated that no chars can be read
* because the end of the stream was reached - ie close() was called on the * because the end of the stream was reached - ie close() was called on the
* connected PipedWriter. * connected PipedWriter.
...@@ -361,3 +366,4 @@ public class PipedReader extends Reader ...@@ -361,3 +366,4 @@ public class PipedReader extends Reader
} }
} }
} }
...@@ -48,8 +48,6 @@ package java.io; ...@@ -48,8 +48,6 @@ package java.io;
* class which also auto-flushes when it encounters a newline character * class which also auto-flushes when it encounters a newline character
* in the chars written). * in the chars written).
* *
* @version 0.0
*
* @author Per Bothner <bothner@cygnus.com> * @author Per Bothner <bothner@cygnus.com>
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
* @date April 17, 1998. * @date April 17, 1998.
...@@ -99,7 +97,8 @@ public class PrintWriter extends Writer ...@@ -99,7 +97,8 @@ public class PrintWriter extends Writer
* every line is terminated or newline character is written. * every line is terminated or newline character is written.
* *
* @param wr The <code>Writer</code> to write to. * @param wr The <code>Writer</code> to write to.
* @param autoflush <code>true</code> to flush the stream after every line, <code>false</code> otherwise * @param autoflush <code>true</code> to flush the stream after every
* line, <code>false</code> otherwise
*/ */
public PrintWriter(Writer wr, boolean autoflush) public PrintWriter(Writer wr, boolean autoflush)
{ {
...@@ -130,7 +129,8 @@ public class PrintWriter extends Writer ...@@ -130,7 +129,8 @@ public class PrintWriter extends Writer
* constructor allows auto-flush functionality to be enabled if desired * constructor allows auto-flush functionality to be enabled if desired
* *
* @param out The <code>OutputStream</code> to write to * @param out The <code>OutputStream</code> to write to
* @param autoflush <code>true</code> to flush the stream after every <code>println</code> call, <code>false</code> otherwise. * @param autoflush <code>true</code> to flush the stream after every
* <code>println</code> call, <code>false</code> otherwise.
*/ */
public PrintWriter(OutputStream out, boolean autoflush) public PrintWriter(OutputStream out, boolean autoflush)
{ {
...@@ -153,7 +153,8 @@ public class PrintWriter extends Writer ...@@ -153,7 +153,8 @@ public class PrintWriter extends Writer
* <code>true</code> forever for this stream. Before checking for an * <code>true</code> forever for this stream. Before checking for an
* error condition, this method flushes the stream. * error condition, this method flushes the stream.
* *
* @return <code>true</code> if an error has occurred, <code>false</code> otherwise * @return <code>true</code> if an error has occurred,
* <code>false</code> otherwise
*/ */
public boolean checkError() public boolean checkError()
{ {
...@@ -309,7 +310,7 @@ public class PrintWriter extends Writer ...@@ -309,7 +310,7 @@ public class PrintWriter extends Writer
* This is the system dependent line separator * This is the system dependent line separator
*/ */
private static final char[] line_separator private static final char[] line_separator
= System.getProperty("line.separator").toCharArray(); = System.getProperty("line.separator").toCharArray();
/** /**
* This method prints a line separator sequence to the stream. The value * This method prints a line separator sequence to the stream. The value
...@@ -567,3 +568,4 @@ public class PrintWriter extends Writer ...@@ -567,3 +568,4 @@ public class PrintWriter extends Writer
write(str, 0, str.length()); write(str, 0, str.length());
} }
} }
/* PushbackReader.java -- An character stream that can unread chars /* PushbackReader.java -- An character stream that can unread chars
Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc. Copyright (C) 1998, 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -48,8 +48,6 @@ package java.io; ...@@ -48,8 +48,6 @@ package java.io;
* The default pushback buffer size one char, but this can be overridden * The default pushback buffer size one char, but this can be overridden
* by the creator of the stream. * by the creator of the stream.
* *
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
* @author Warren Levy <warrenl@cygnus.com> * @author Warren Levy <warrenl@cygnus.com>
*/ */
...@@ -136,7 +134,8 @@ public class PushbackReader extends FilterReader ...@@ -136,7 +134,8 @@ public class PushbackReader extends FilterReader
* This method returns <code>false</code> to indicate that it does not support * This method returns <code>false</code> to indicate that it does not support
* mark/reset functionality. * mark/reset functionality.
* *
* @return This method returns <code>false</code> to indicate that this class does not support mark/reset functionality * @return This method returns <code>false</code> to indicate that this
* class does not support mark/reset functionality
* *
*/ */
public boolean markSupported() public boolean markSupported()
...@@ -165,7 +164,8 @@ public class PushbackReader extends FilterReader ...@@ -165,7 +164,8 @@ public class PushbackReader extends FilterReader
* read in the pushback buffer or if the underlying stream is ready to * read in the pushback buffer or if the underlying stream is ready to
* be read. * be read.
* *
* @return <code>true</code> if this stream is ready to be read, <code>false</code> otherwise * @return <code>true</code> if this stream is ready to be read,
* <code>false</code> otherwise
* *
* @exception IOException If an error occurs * @exception IOException If an error occurs
*/ */
...@@ -252,7 +252,8 @@ public class PushbackReader extends FilterReader ...@@ -252,7 +252,8 @@ public class PushbackReader extends FilterReader
/** /**
* This method read chars from a stream and stores them into a caller * This method read chars from a stream and stores them into a caller
* supplied buffer. It starts storing the data at index <code>offset</code> into * supplied buffer. It starts storing the data at index <code>offset</code>
* into
* the buffer and attempts to read <code>len</code> chars. This method can * the buffer and attempts to read <code>len</code> chars. This method can
* return before reading the number of chars requested. The actual number * return before reading the number of chars requested. The actual number
* of chars read is returned as an int. A -1 is returned to indicate the * of chars read is returned as an int. A -1 is returned to indicate the
...@@ -302,8 +303,8 @@ public class PushbackReader extends FilterReader ...@@ -302,8 +303,8 @@ public class PushbackReader extends FilterReader
* <p> * <p>
* If the pushback buffer is full, this method throws an exception. * If the pushback buffer is full, this method throws an exception.
* <p> * <p>
* The argument to this method is an <code>int</code>. Only the low eight bits * The argument to this method is an <code>int</code>. Only the low eight
* of this value are pushed back. * bits of this value are pushed back.
* *
* @param b The char to be pushed back, passed as an int * @param b The char to be pushed back, passed as an int
* *
...@@ -343,7 +344,8 @@ public class PushbackReader extends FilterReader ...@@ -343,7 +344,8 @@ public class PushbackReader extends FilterReader
/** /**
* This method pushed back chars from the passed in array into the pushback * This method pushed back chars from the passed in array into the pushback
* buffer. The chars from <code>buf[offset]</code> to <code>buf[offset + len]</code> * buffer. The chars from <code>buf[offset]</code> to
* <code>buf[offset + len]</code>
* are pushed in reverse order so that the next char read from the stream * are pushed in reverse order so that the next char read from the stream
* after this operation will be <code>buf[offset]</code> followed by * after this operation will be <code>buf[offset]</code> followed by
* <code>buf[offset + 1]</code>, etc. * <code>buf[offset + 1]</code>, etc.
...@@ -378,3 +380,4 @@ public class PushbackReader extends FilterReader ...@@ -378,3 +380,4 @@ public class PushbackReader extends FilterReader
} }
} }
} }
/* Reader.java -- base class of classes that read input as a stream of chars /* Reader.java -- base class of classes that read input as a stream of chars
Copyright (C) 1998, 1999, 2000 Free Software Foundation Copyright (C) 1998, 1999, 2000, 2003 Free Software Foundation
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -222,7 +222,8 @@ public abstract class Reader ...@@ -222,7 +222,8 @@ public abstract class Reader
* <p> * <p>
* This method always returns <code>false</code> in this class * This method always returns <code>false</code> in this class
* *
* @return <code>true</code> if the stream is ready to be read, <code>false</code> otherwise. * @return <code>true</code> if the stream is ready to be read,
* <code>false</code> otherwise.
* *
* @exception IOException If an error occurs * @exception IOException If an error occurs
*/ */
......
/* SerializablePermission.java -- Basic permissions related to serialization. /* SerializablePermission.java -- Basic permissions related to serialization.
Copyright (C) 1998, 2000 Free Software Foundation, Inc. Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -55,64 +55,63 @@ import java.security.BasicPermission; ...@@ -55,64 +55,63 @@ import java.security.BasicPermission;
* *
* @see java.security.BasicPermission * @see java.security.BasicPermission
* *
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
*/ */
public final class SerializablePermission extends BasicPermission public final class SerializablePermission extends BasicPermission
{ {
static final long serialVersionUID = 8537212141160296410L; static final long serialVersionUID = 8537212141160296410L;
/* /*
* Class Variables * Class Variables
*/ */
private static final String[] legal_names = { "enableSubclassImplementation", private static final String[] legal_names = { "enableSubclassImplementation",
"enableSubstitution" }; "enableSubstitution" };
/*************************************************************************/ /*************************************************************************/
/* /*
* Constructors * Constructors
*/ */
/** /**
* This method initializes a new instance of <code>SerializablePermission</code> * This method initializes a new instance of
* that has the specified name. * <code>SerializablePermission</code>
* * that has the specified name.
* @param name The name of the permission. *
* * @param name The name of the permission.
* @exception IllegalArgumentException If the name is not valid for this class. *
*/ * @exception IllegalArgumentException If the name is not valid for
public * this class.
SerializablePermission(String name) */
{ public SerializablePermission(String name)
this(name, null); {
} this(name, null);
}
/*************************************************************************/
/*************************************************************************/
/**
* This method initializes a new instance of <code>SerializablePermission</code> /**
* that has the specified name and action list. Note that the action list * This method initializes a new instance of
* is unused in this class. * <code>SerializablePermission</code>
* * that has the specified name and action list. Note that the action list
* @param name The name of the permission. * is unused in this class.
* @param actions The action list (unused). *
* * @param name The name of the permission.
* @exception IllegalArgumentException If the name is not valid for this class. * @param actions The action list (unused).
*/ *
public * @exception IllegalArgumentException If the name is not valid for
SerializablePermission(String name, String actions) * this class.
{ */
super(name, actions); public SerializablePermission(String name, String actions)
{
for (int i = 0; i < legal_names.length; i++) super(name, actions);
if (legal_names[i].equals(name))
return; for (int i = 0; i < legal_names.length; i++)
if (legal_names[i].equals(name))
throw new IllegalArgumentException("Bad permission name: " + name); return;
}
throw new IllegalArgumentException("Bad permission name: " + name);
}
} // class SerializablePermission } // class SerializablePermission
/* StringReader.java -- permits a String to be read as a character input stream /* StringReader.java -- permits a String to be read as a character input stream
Copyright (C) 1998, 1999, 2000 Free Software Foundation Copyright (C) 1998, 1999, 2000, 2003 Free Software Foundation
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -51,8 +51,6 @@ package java.io; ...@@ -51,8 +51,6 @@ package java.io;
* normal. If no mark has been set, then calling the <code>reset()</code> * normal. If no mark has been set, then calling the <code>reset()</code>
* method rewinds the read pointer to the beginning of the <code>String</code>. * method rewinds the read pointer to the beginning of the <code>String</code>.
* *
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com) * @author Aaron M. Renn (arenn@urbanophile.com)
* @author Warren Levy <warrenl@cygnus.com> * @author Warren Levy <warrenl@cygnus.com>
* @date October 19, 1998. * @date October 19, 1998.
...@@ -73,8 +71,8 @@ public class StringReader extends Reader ...@@ -73,8 +71,8 @@ public class StringReader extends Reader
/** /**
* Create a new <code>StringReader</code> that will read chars from the * Create a new <code>StringReader</code> that will read chars from the
* passed in <code>String</code>. This stream will read from the beginning to the * passed in <code>String</code>. This stream will read from the beginning
* end of the <code>String</code>. * to the end of the <code>String</code>.
* *
* @param s The <code>String</code> this stream will read from. * @param s The <code>String</code> this stream will read from.
*/ */
...@@ -208,3 +206,4 @@ public class StringReader extends Reader ...@@ -208,3 +206,4 @@ public class StringReader extends Reader
} }
} }
} }
/* Writer.java -- Base class for character output streams /* Writer.java -- Base class for character output streams
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -55,168 +55,161 @@ package java.io; ...@@ -55,168 +55,161 @@ package java.io;
*/ */
public abstract class Writer public abstract class Writer
{ {
/**
/*************************************************************************/ * 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>
* This is the object used to synchronize criticial code sections for */
* thread safety. Subclasses should use this field instead of using protected Object lock;
* synchronized methods or explicity synchronizations on <code>this</code>
*/ /*************************************************************************/
protected Object lock;
/*
/*************************************************************************/ * Constructors
*/
/*
* Constructors /**
*/ * This is the default no-argument constructor for this class. This method
* will set up the class to synchronize criticial sections on itself.
/** */
* This is the default no-argument constructor for this class. This method protected Writer()
* will set up the class to synchronize criticial sections on itself. {
*/ lock = this;
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
* This method initializes a <code>Writer</code> that will synchronize * sections
* on the specified <code>Object</code>. */
* protected Writer(Object lock)
* @param obj The <code>Object</code> to use for synchronizing critical {
* sections this.lock = lock;
*/ }
protected
Writer(Object lock) /*************************************************************************/
{
this.lock = lock; /*
} * Instance Methods
*/
/*************************************************************************/
/**
/* * This method forces any data that may have been buffered to be written
* Instance Methods * 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.
* This method forces any data that may have been buffered to be written *
* to the underlying output device. Please note that the host environment * @exception IOException If an error occurs
* 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 public abstract void flush() throws IOException;
* buffers instead of actually being written to disk.
* /*************************************************************************/
* @exception IOException If an error occurs
*/ /**
public abstract void * This method closes the stream. Any internal or native resources
flush() throws IOException; * 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.
* This method closes the stream. Any internal or native resources associated *
* with this stream are freed. Any subsequent attempt to access the stream * @exception IOException If an error occurs
* might throw an exception. */
* <p> public abstract void close() throws IOException;
* This method in this class does nothing.
* /*************************************************************************/
* @exception IOException If an error occurs
*/ /**
public abstract void * This method writes a single char to the output stream.
close() throws IOException; *
* @param b The char to be written to the output stream, passed as an int
/*************************************************************************/ *
* @exception IOException If an error occurs
/** */
* This method writes a single char to the output stream. public void write(int b) throws IOException
* {
* @param b The char to be written to the output stream, passed as an int char[] buf = new char[1];
*
* @exception IOException If an error occurs buf[0] = (char)b;
*/ write(buf, 0, buf.length);
public void }
write(int b) throws IOException
{ /*************************************************************************/
char[] buf = new char[1];
/**
buf[0] = (char)b; * This method all the writes char from the passed array to the output
write(buf, 0, buf.length); * 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
/** *
* This method all the writes char from the passed array to the output stream. * @exception IOException If an error occurs
* This method is equivalent to <code>write(buf, 0, buf.length)</code> which */
* is exactly how it is implemented in this class. public void write(char[] buf) throws IOException
* {
* @param buf The array of char to write write(buf, 0, buf.length);
* }
* @exception IOException If an error occurs
*/ /*************************************************************************/
public void
write(char[] buf) throws IOException /**
{ * This method writes <code>len</code> char from the specified array
write(buf, 0, buf.length); * <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
* This method writes <code>len</code> char from the specified array * @param len The number of char to write
* <code>buf</code> starting at index <code>offset</code> into the array. *
* <p> * @exception IOException If an error occurs
* Subclasses must provide an implementation of this abstract method. */
* public abstract void write(char[] buf, int offset, int len)
* @param buf The array of char to write from throws IOException;
* @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 /**
*/ * This method writes all the characters in a <code>String</code> to the
public abstract void * output.
write(char[] buf, int offset, int len) throws IOException; *
* @param str The <code>String</code> whose chars are to be written.
/*************************************************************************/ *
* @param IOException If an error occurs
/** */
* This method writes all the characters in a <code>String</code> to the public void write(String str) throws IOException
* output. {
* write(str, 0, str.length());
* @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 * This method writes <code>len</code> chars from the <code>String</code>
{ * starting at position <code>offset</code>.
write(str, 0, str.length()); *
} * @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
/** *
* This method writes <code>len</code> chars from the <code>String</code> * @exception IOException If an error occurs
* starting at position <code>offset</code>. */
* public void write(String str, int offset, int len) throws IOException
* @param str The <code>String</code> that is to be written {
* @param offset The character offset into the <code>String</code> to start // FIXME - for libgcj re-write using native code to not require
* writing from // copied buffer.
* @param len The number of chars to write char[] buf = new char[len];
*
* @exception IOException If an error occurs str.getChars(offset, offset + len, buf, 0);
*/ write(buf, 0, len);
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 } // class Writer
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment