BufferedWriter.java, [...]: Fixed javadocs all over, rename arguments to match javadocs, fixed coding style.

2004-04-20  Michael Koch  <konqueror@gmx.de>

	* java/io/BufferedWriter.java,
	java/io/ByteArrayInputStream.java,
	java/io/CharArrayWriter.java,
	java/io/DataInput.java,
	java/io/DataInputStream.java,
	java/io/File.java,
	java/io/FilterInputStream.java,
	java/io/InputStream.java,
	java/io/InputStreamReader.java,
	java/io/ObjectInputStream.java,
	java/io/ObjectStreamClass.java,
	java/io/PipedInputStream.java,
	java/io/PipedReader.java,
	java/io/PushbackInputStream.java,
	java/io/PushbackReader.java,
	java/io/RandomAccessFile.java,
	java/io/SerializablePermission.java,
	java/io/StreamTokenizer.java,
	java/io/StringWriter.java,
	java/io/WriteAbortedException.java,
	java/io/Writer.java:
	Fixed javadocs all over, rename arguments to match javadocs,
	fixed coding style.

From-SVN: r80897
This commit is contained in:
Michael Koch 2004-04-20 11:37:41 +00:00 committed by Michael Koch
parent 7aebacee26
commit 9f714d5eec
22 changed files with 193 additions and 169 deletions

View File

@ -1,3 +1,29 @@
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/io/BufferedWriter.java,
java/io/ByteArrayInputStream.java,
java/io/CharArrayWriter.java,
java/io/DataInput.java,
java/io/DataInputStream.java,
java/io/File.java,
java/io/FilterInputStream.java,
java/io/InputStream.java,
java/io/InputStreamReader.java,
java/io/ObjectInputStream.java,
java/io/ObjectStreamClass.java,
java/io/PipedInputStream.java,
java/io/PipedReader.java,
java/io/PushbackInputStream.java,
java/io/PushbackReader.java,
java/io/RandomAccessFile.java,
java/io/SerializablePermission.java,
java/io/StreamTokenizer.java,
java/io/StringWriter.java,
java/io/WriteAbortedException.java,
java/io/Writer.java:
Fixed javadocs all over, rename arguments to match javadocs,
fixed coding style.
2004-04-20 Ingo Proetel <proetel@aicas.com>
* java/awt/FontMetrics.java:

View File

@ -44,18 +44,17 @@ package java.io;
*/
/**
* This class accumulates chars written in a buffer instead of immediately
* writing the data to the underlying output sink. The chars are instead
* as one large block when the buffer is filled, or when the stream is
* closed or explicitly flushed. This mode operation can provide a more
* efficient mechanism for writing versus doing numerous small unbuffered
* writes.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@cygnus.com>
* @date September 25, 1998
*/
* This class accumulates chars written in a buffer instead of immediately
* writing the data to the underlying output sink. The chars are instead
* as one large block when the buffer is filled, or when the stream is
* closed or explicitly flushed. This mode operation can provide a more
* efficient mechanism for writing versus doing numerous small unbuffered
* writes.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey (tromey@cygnus.com)
* @date September 25, 1998
*/
public class BufferedWriter extends Writer
{
/**
@ -90,6 +89,8 @@ public class BufferedWriter extends Writer
* This method flushes any remaining buffered chars then closes the
* underlying output stream. Any further attempts to write to this stream
* may throw an exception
*
* @exception IOException If an error occurs.
*/
public void close () throws IOException
{
@ -138,7 +139,7 @@ public class BufferedWriter extends Writer
* is filled as a result of this write request, it will be flushed to the
* underlying output stream.
*
* @param b The char of data to be written, passed as an int
* @param oneChar The char of data to be written, passed as an int
*
* @exception IOException If an error occurs
*/

View File

@ -83,7 +83,7 @@ public class ByteArrayInputStream extends InputStream
* bytes supplied to the reader. Please use caution in changing the
* contents of the buffer while this stream is open.
*
* @param buf The byte array buffer this stream will read from.
* @param buffer The byte array buffer this stream will read from.
*/
public ByteArrayInputStream(byte[] buffer)
{
@ -105,7 +105,7 @@ public class ByteArrayInputStream extends InputStream
* bytes supplied to the reader. Please use caution in changing the
* contents of the buffer while this stream is open.
*
* @param buf The byte array buffer this stream will read from.
* @param buffer The byte array buffer this stream will read from.
* @param offset The index into the buffer to start reading bytes from
* @param length The number of bytes to read from the buffer
*/
@ -146,12 +146,12 @@ public class ByteArrayInputStream extends InputStream
* position 0 in the stream. This is in constrast to some other
* stream types where there is no default mark position.
*
* @param readlimit The number of bytes this stream must remember.
* @param readLimit The number of bytes this stream must remember.
* This parameter is ignored.
*/
public synchronized void mark(int readAheadLimit)
public synchronized void mark(int readLimit)
{
// readAheadLimit is ignored per Java Class Lib. book, p.220.
// readLimit is ignored per Java Class Lib. book, p.220.
mark = pos;
}
@ -197,19 +197,19 @@ public class ByteArrayInputStream extends InputStream
* <p>
* This method does not block.
*
* @param buf The array into which the bytes read should be stored.
* @param buffer The array into which the bytes read should be stored.
* @param offset The offset into the array to start storing bytes
* @param len The requested number of bytes to read
* @param length The requested number of bytes to read
*
* @return The actual number of bytes read, or -1 if end of stream.
*/
public synchronized int read(byte[] b, int off, int len)
public synchronized int read(byte[] buffer, int offset, int length)
{
if (pos >= count)
return -1;
int numBytes = Math.min(count - pos, len);
System.arraycopy(buf, pos, b, off, numBytes);
int numBytes = Math.min(count - pos, length);
System.arraycopy(buf, pos, buffer, offset, numBytes);
pos += numBytes;
return numBytes;
}
@ -234,17 +234,17 @@ public class ByteArrayInputStream extends InputStream
* position the stream at the end of the buffer. The actual number
* of bytes skipped is returned.
*
* @param num_bytes The requested number of bytes to skip
* @param num The requested number of bytes to skip
*
* @return The actual number of bytes skipped.
*/
public synchronized long skip(long n)
public synchronized long skip(long num)
{
// Even though the var numBytes is a long, in reality it can never
// be larger than an int since the result of subtracting 2 positive
// ints will always fit in an int. Since we have to return a long
// anyway, numBytes might as well just be a long.
long numBytes = Math.min((long) (count - pos), n < 0 ? 0L : n);
long numBytes = Math.min((long) (count - pos), num < 0 ? 0L : num);
pos += numBytes;
return numBytes;
}

View File

@ -50,8 +50,8 @@ package java.io;
* following two properties:
* <p>
* <ul>
* <li><xmp>gnu.java.io.CharArrayWriter.initialBufferSize</xmp>
* <li><xmp>gnu.java.io.CharArrayWriter.bufferIncrementSize</xmp>
* <li><xmp>gnu.java.io.CharArrayWriter.initialBufferSize</xmp></li>
* <li><xmp>gnu.java.io.CharArrayWriter.bufferIncrementSize</xmp></li>
* </ul>
* <p>
* There is a constructor that specified the initial buffer size and

View File

@ -360,7 +360,7 @@ public interface DataInput
* patterns which indicate a two byte character encoding, then they would be
* converted to a Java <code>char</code> like so:
* <p>
* <code>(char)(((byte1 & 0x1F) << 6) + (byte2 & 0x3F))</code>
* <code>(char)(((byte1 &amp; 0x1F) &lt;&lt; 6) + (byte2 &amp; 0x3F))</code>
* <p>
* If the first byte has a 1110 as its high order bits, then the
* character consists of three bytes. The bits that make up the character
@ -375,19 +375,19 @@ public interface DataInput
* then they would be converted to a Java <code>char</code> like so:
*
* <code>
* (char)(((byte1 & 0x0F) << 12) + ((byte2 & 0x3F) + (byte3 & 0x3F))
* (char)(((byte1 &amp; 0x0F) &lt;&lt; 12) + ((byte2 &amp; 0x3F) + (byte3 &amp; 0x3F))
* </code>
*
* Note that all characters are encoded in the method that requires the
* fewest number of bytes with the exception of the character with the
* value of <code>\<llll>u0000</code> which is encoded as two bytes.
* value of <code>\&lt;llll&gt;u0000</code> which is encoded as two bytes.
* This is a modification of the UTF standard used to prevent C language
* style <code>NUL</code> values from appearing in the byte stream.
* <p>
* This method can read data that was written by an object implementing the
* <code>writeUTF()</code> method in <code>DataOutput</code>.
*
* @returns The <code>String</code> read
* @return The <code>String</code> read
*
* @exception EOFException If end of file is reached before reading the
* String

View File

@ -277,16 +277,16 @@ public class DataInputStream extends FilterInputStream implements DataInput
* buffer
* @exception IOException If any other error occurs
*/
public final void readFully (byte[] b, int off, int len) throws IOException
public final void readFully (byte[] buf, int offset, int len) throws IOException
{
while (len > 0)
{
// in.read will block until some data is available.
int numread = in.read (b, off, len);
int numread = in.read (buf, offset, len);
if (numread < 0)
throw new EOFException ();
len -= numread;
off += numread;
offset += numread;
}
}

View File

@ -1,5 +1,6 @@
/* File.java -- Class representing a file on disk
Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -121,7 +122,7 @@ public class File implements Serializable, Comparable
{
if (Configuration.INIT_LOAD_LIBRARY)
{
System.loadLibrary ("javaio");
System.loadLibrary("javaio");
}
init_native();
@ -187,7 +188,7 @@ public class File implements Serializable, Comparable
* the path of this <code>File</code> object if an only if that file
* does not already exist.
* <p>
* A <code>SecurityManager</code>checkWrite</code> check is done prior
* A <code>SecurityManager.checkWrite</code> check is done prior
* to performing this action.
*
* @return <code>true</code> if the file was created, <code>false</code> if
@ -224,7 +225,7 @@ public class File implements Serializable, Comparable
SecurityManager s = System.getSecurityManager();
if (s != null)
s.checkDelete (path);
s.checkDelete(path);
return performDelete();
}
@ -244,7 +245,7 @@ public class File implements Serializable, Comparable
* @return <code>true</code> if the two objects are equal,
* <code>false</code> otherwise.
*/
public boolean equals (Object obj)
public boolean equals(Object obj)
{
if (! (obj instanceof File))
return false;
@ -252,9 +253,9 @@ public class File implements Serializable, Comparable
File other = (File) obj;
if (caseSensitive)
return path.equals (other.path);
return path.equals(other.path);
else
return path.equalsIgnoreCase (other.path);
return path.equalsIgnoreCase(other.path);
}
/**
@ -277,7 +278,7 @@ public class File implements Serializable, Comparable
*
* @param name The path name of the file
*/
public File (String name)
public File(String name)
{
path = normalizePath (name);
}
@ -354,7 +355,7 @@ public class File implements Serializable, Comparable
* @param dirPath The path to the directory the file resides in
* @param name The name of the file
*/
public File (String dirPath, String name)
public File(String dirPath, String name)
{
if (name == null)
throw new NullPointerException();
@ -381,7 +382,7 @@ public class File implements Serializable, Comparable
* @param directory The directory this file resides in
* @param name The name of the file
*/
public File (File directory, String name)
public File(File directory, String name)
{
this (directory == null ? null : directory.path, name);
}
@ -448,7 +449,7 @@ public class File implements Serializable, Comparable
*/
public File getAbsoluteFile()
{
return new File (getAbsolutePath());
return new File(getAbsolutePath());
}
/**
@ -479,7 +480,7 @@ public class File implements Serializable, Comparable
*/
public File getCanonicalFile() throws IOException
{
return new File (getCanonicalPath());
return new File(getCanonicalPath());
}
/**
@ -591,7 +592,7 @@ public class File implements Serializable, Comparable
public File getParentFile()
{
String parent = getParent();
return parent != null ? new File (parent) : null;
return parent != null ? new File(parent) : null;
}
/**
@ -748,7 +749,7 @@ public class File implements Serializable, Comparable
* @exception SecurityException If read access is not allowed to the
* directory by the <code>SecurityManager</code>
*/
public String[] list (FilenameFilter filter)
public String[] list(FilenameFilter filter)
{
checkRead();
return (String[]) performList (filter, null, String.class);
@ -826,7 +827,7 @@ public class File implements Serializable, Comparable
*
* @since 1.2
*/
public File[] listFiles (FilenameFilter filter)
public File[] listFiles(FilenameFilter filter)
{
checkRead();
return (File[]) performList (filter, null, File.class);
@ -856,7 +857,7 @@ public class File implements Serializable, Comparable
*
* @since 1.2
*/
public File[] listFiles (FileFilter filter)
public File[] listFiles(FileFilter filter)
{
checkRead();
return (File[]) performList (null, filter, File.class);
@ -982,8 +983,8 @@ public class File implements Serializable, Comparable
*
* @since 1.2
*/
public static File createTempFile (String prefix, String suffix,
File directory)
public static File createTempFile(String prefix, String suffix,
File directory)
throws IOException
{
// Grab the system temp directory if necessary
@ -1005,7 +1006,7 @@ public class File implements Serializable, Comparable
// Check if prefix is at least 3 characters long
if (prefix.length() < 3)
throw new IllegalArgumentException ("Prefix too short: " + prefix);
throw new IllegalArgumentException("Prefix too short: " + prefix);
// Set default value of suffix
if (suffix == null)
@ -1146,10 +1147,10 @@ public class File implements Serializable, Comparable
* this operation
* @exception IOException If an error occurs
*/
public static File createTempFile (String prefix, String suffix)
public static File createTempFile(String prefix, String suffix)
throws IOException
{
return createTempFile (prefix, suffix, null);
return createTempFile(prefix, suffix, null);
}
/**
@ -1168,7 +1169,7 @@ public class File implements Serializable, Comparable
*
* @since 1.2
*/
public int compareTo (File other)
public int compareTo(File other)
{
if (caseSensitive)
return path.compareTo (other.path);
@ -1197,9 +1198,9 @@ public class File implements Serializable, Comparable
*
* @since 1.2
*/
public int compareTo (Object obj)
public int compareTo(Object obj)
{
return compareTo ((File) obj);
return compareTo((File) obj);
}
/*
@ -1219,7 +1220,7 @@ public class File implements Serializable, Comparable
* @exception SecurityException If write access is not allowed to the
* file by the <code>SecurityMananger</code>.
*/
public synchronized boolean renameTo (File dest)
public synchronized boolean renameTo(File dest)
{
SecurityManager s = System.getSecurityManager();
String sname = getName();
@ -1253,7 +1254,7 @@ public class File implements Serializable, Comparable
*
* @since 1.2
*/
public boolean setLastModified (long time)
public boolean setLastModified(long time)
{
if (time < 0)
throw new IllegalArgumentException("Negative modification time: " + time);
@ -1268,7 +1269,7 @@ public class File implements Serializable, Comparable
SecurityManager s = System.getSecurityManager();
if (s != null)
s.checkWrite (path);
s.checkWrite(path);
}
private void checkRead()
@ -1277,7 +1278,7 @@ public class File implements Serializable, Comparable
SecurityManager s = System.getSecurityManager();
if (s != null)
s.checkRead (path);
s.checkRead(path);
}
/**
@ -1299,13 +1300,13 @@ public class File implements Serializable, Comparable
FileDeleter.add (this);
}
private void writeObject (ObjectOutputStream oos) throws IOException
private void writeObject(ObjectOutputStream oos) throws IOException
{
oos.defaultWriteObject();
oos.writeChar (separatorChar);
oos.writeChar(separatorChar);
}
private void readObject (ObjectInputStream ois)
private void readObject(ObjectInputStream ois)
throws ClassNotFoundException, IOException
{
ois.defaultReadObject();
@ -1315,7 +1316,7 @@ public class File implements Serializable, Comparable
char oldSeparatorChar = ois.readChar();
if (oldSeparatorChar != separatorChar)
path = path.replace (oldSeparatorChar, separatorChar);
path = path.replace(oldSeparatorChar, separatorChar);
}
} // class File

View File

@ -104,7 +104,7 @@ public class FilterInputStream extends InputStream
*/
public boolean markSupported()
{
return(in.markSupported());
return in.markSupported();
}
/**
@ -126,7 +126,7 @@ public class FilterInputStream extends InputStream
*/
public int available() throws IOException
{
return(in.available());
return in.available();
}
/**
@ -138,9 +138,9 @@ public class FilterInputStream extends InputStream
*
* @exception IOException If an error occurs
*/
public long skip(long num_bytes) throws IOException
public long skip(long numBytes) throws IOException
{
return(in.skip(num_bytes));
return in.skip(numBytes);
}
/**
@ -152,7 +152,7 @@ public class FilterInputStream extends InputStream
*/
public int read() throws IOException
{
return(in.read());
return in.read();
}
/**
@ -170,7 +170,7 @@ public class FilterInputStream extends InputStream
*/
public int read(byte[] buf) throws IOException
{
return(read(buf, 0, buf.length));
return read(buf, 0, buf.length);
}
/**
@ -186,7 +186,7 @@ public class FilterInputStream extends InputStream
*/
public int read(byte[] buf, int offset, int len) throws IOException
{
return(in.read(buf, offset, len));
return in.read(buf, offset, len);
}
/**
@ -200,6 +200,4 @@ public class FilterInputStream extends InputStream
{
in.close();
}
} // class FilterInputStream
}

View File

@ -105,7 +105,7 @@ public abstract class InputStream
* @param readLimit The number of bytes that can be read before the
* mark becomes invalid
*/
public void mark(int readlimit)
public void mark(int readLimit)
{
// Do nothing
}
@ -117,7 +117,7 @@ public abstract class InputStream
* point.
* <p>
* This method always returns <code>false</code> in this class, but
* subclasses can override this method to return </code>true</code>
* subclasses can override this method to return <code>true</code>
* if they support mark/reset functionality.
*
* @return <code>true</code> if mark/reset functionality is

View File

@ -56,18 +56,18 @@ import gnu.gcj.convert.*;
* Here is a list of standard encoding names that may be available:
* <p>
* <ul>
* <li>8859_1 (ISO-8859-1/Latin-1)
* <li>8859_2 (ISO-8859-2/Latin-2)
* <li>8859_3 (ISO-8859-3/Latin-3)
* <li>8859_4 (ISO-8859-4/Latin-4)
* <li>8859_5 (ISO-8859-5/Latin-5)
* <li>8859_6 (ISO-8859-6/Latin-6)
* <li>8859_7 (ISO-8859-7/Latin-7)
* <li>8859_8 (ISO-8859-8/Latin-8)
* <li>8859_9 (ISO-8859-9/Latin-9)
* <li>ASCII (7-bit ASCII)
* <li>UTF8 (UCS Transformation Format-8)
* <li>More later
* <li>8859_1 (ISO-8859-1/Latin-1)</li>
* <li>8859_2 (ISO-8859-2/Latin-2)</li>
* <li>8859_3 (ISO-8859-3/Latin-3)</li>
* <li>8859_4 (ISO-8859-4/Latin-4)</li>
* <li>8859_5 (ISO-8859-5/Latin-5)</li>
* <li>8859_6 (ISO-8859-6/Latin-6)</li>
* <li>8859_7 (ISO-8859-7/Latin-7)</li>
* <li>8859_8 (ISO-8859-8/Latin-8)</li>
* <li>8859_9 (ISO-8859-9/Latin-9)</li>
* <li>ASCII (7-bit ASCII)</li>
* <li>UTF8 (UCS Transformation Format-8)</li>
* <li>More later</li>
* </ul>
* <p>
* It is recommended that applications do not use
@ -170,7 +170,7 @@ public class InputStreamReader extends Reader
* by this object. If the stream has been closed, this method is allowed
* to return <code>null</code>.
*
* @param The current encoding name
* @return The current encoding name
*/
public String getEncoding()
{
@ -296,5 +296,4 @@ public class InputStreamReader extends Reader
return count;
}
}
} // class InputStreamReader
}

View File

@ -38,24 +38,20 @@ exception statement from your version. */
package java.io;
import gnu.classpath.Configuration;
import gnu.java.io.ObjectIdentityWrapper;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Proxy;
import java.security.PrivilegedAction;
import java.security.AccessController;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
import gnu.java.io.ObjectIdentityWrapper;
import gnu.java.lang.reflect.TypeSignature;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import gnu.classpath.Configuration;
public class ObjectInputStream extends InputStream
implements ObjectInput, ObjectStreamConstants
{

View File

@ -104,17 +104,17 @@ public class ObjectStreamClass implements Serializable
}
}
/**
* Returns the name of the class that this
* <code>ObjectStreamClass</code> represents.
*
* @return the name of the class.
*/
public String getName()
{
return name;
}
/**
* Returns the class that this <code>ObjectStreamClass</code>
* represents. Null could be returned if this
@ -129,24 +129,27 @@ public class ObjectStreamClass implements Serializable
return clazz;
}
/**
* Returns the serial version stream-unique identifier for the class
* represented by this <code>ObjectStreamClass</code>. This SUID is
* either defined by the class as <code>static final long
* serialVersionUID</code> or is calculated as specified in
* Javasoft's "Object Serialization Specification" XXX: add reference
*
* @return the serial version UID.
*/
public long getSerialVersionUID()
{
return uid;
}
// Returns the serializable (non-static and non-transient) Fields
// of the class represented by this ObjectStreamClass. The Fields
// are sorted by name.
// XXX doc
/**
* Returns the serializable (non-static and non-transient) Fields
* of the class represented by this ObjectStreamClass. The Fields
* are sorted by name.
*
* @return the fields.
*/
public ObjectStreamField[] getFields()
{
ObjectStreamField[] copy = new ObjectStreamField[ fields.length ];
@ -154,7 +157,6 @@ public class ObjectStreamClass implements Serializable
return copy;
}
// XXX doc
// Can't do binary search since fields is sorted by name and
// primitiveness.
@ -166,7 +168,6 @@ public class ObjectStreamClass implements Serializable
return null;
}
/**
* Returns a textual representation of this
* <code>ObjectStreamClass</code> object including the name of the
@ -181,7 +182,6 @@ public class ObjectStreamClass implements Serializable
return "java.io.ObjectStreamClass< " + name + ", " + uid + " >";
}
// Returns true iff the class that this ObjectStreamClass represents
// has the following method:
//

View File

@ -277,7 +277,7 @@ public class PipedInputStream extends InputStream
* @param offset The index into the buffer at which to start writing.
* @param len The maximum number of bytes to read.
*
* @exception IOException If <code>close()/code> was called on this Piped
* @exception IOException If <code>close()</code> was called on this Piped
* InputStream.
*/
public synchronized int read(byte[] buf, int offset, int len)

View File

@ -256,7 +256,7 @@ public class PipedReader extends Reader
* @param offset The index into the buffer at which to start writing.
* @param len The maximum number of chars to read.
*
* @exception IOException If <code>close()/code> was called on this Piped
* @exception IOException If <code>close()</code> was called on this Piped
* Reader.
*/
public int read(char[] buf, int offset, int len)

View File

@ -263,7 +263,7 @@ public class PushbackInputStream extends FilterInputStream
/**
* This method pushed back bytes from the passed in array into the
* pushback buffer. The bytes from <code>b[offset]</code> to
* <cdoe>b[offset + len]</code> are pushed in reverse order so that
* <code>b[offset + len]</code> are pushed in reverse order so that
* the next byte read from the stream after this operation will be
* <code>b[offset]</code> followed by <code>b[offset + 1]</code>,
* etc.

View File

@ -266,33 +266,34 @@ public class PushbackReader extends FilterReader
* of the chars requested, the remaining chars are read from the
* underlying stream.
*
* @param buf The array into which the chars read should be stored
* @param buffer The array into which the chars read should be stored
* @param offset The offset into the array to start storing chars
* @param len The requested number of chars to read
* @param length The requested number of chars to read
*
* @return The actual number of chars read, or -1 if end of stream.
*
* @exception IOException If an error occurs.
*/
public synchronized int read(char[] b, int offset, int len) throws IOException
public synchronized int read(char[] buffer, int offset, int length)
throws IOException
{
synchronized (lock)
{
if (buf == null)
throw new IOException("stream closed");
if (offset < 0 || len < 0 || offset + len > b.length)
if (offset < 0 || length < 0 || offset + length > buffer.length)
throw new ArrayIndexOutOfBoundsException();
int numBytes = Math.min(buf.length - pos, len);
int numBytes = Math.min(buf.length - pos, length);
if (numBytes > 0)
{
System.arraycopy (buf, pos, b, offset, numBytes);
System.arraycopy (buf, pos, buffer, offset, numBytes);
pos += numBytes;
return numBytes;
}
return super.read(b, offset, len);
return super.read(buffer, offset, length);
}
}
@ -353,30 +354,30 @@ public class PushbackReader extends FilterReader
* If the pushback buffer cannot hold all of the requested chars, an
* exception is thrown.
*
* @param buf The char array to be pushed back
* @param buffer The char array to be pushed back
* @param offset The index into the array where the chars to be push start
* @param len The number of chars to be pushed.
* @param length The number of chars to be pushed.
*
* @exception IOException If the pushback buffer is full
*/
public synchronized void unread(char[] b, int offset, int len)
public synchronized void unread(char[] buffer, int offset, int length)
throws IOException
{
synchronized (lock)
{
if (buf == null)
throw new IOException("stream closed");
if (pos < len)
if (pos < length)
throw new IOException("Pushback buffer is full");
// Note the order that these chars are being added is the opposite
// of what would be done if they were added to the buffer one at a time.
// See the Java Class Libraries book p. 1397.
System.arraycopy(b, offset, buf, pos - len, len);
System.arraycopy(buffer, offset, buf, pos - length, length);
// Don't put this into the arraycopy above, an exception might be thrown
// and in that case we don't want to modify pos.
pos -= len;
pos -= length;
}
}
}

View File

@ -318,12 +318,12 @@ public class RandomAccessFile implements DataOutput, DataInput
* significant byte first (i.e., "big endian") regardless of the native
* host byte ordering.
* <p>
* As an example, if <code>byte1</code> and code{byte2</code> represent
* As an example, if <code>byte1</code> and <code>byte2</code> represent
* the first
* and second byte read from the stream respectively, they will be
* transformed to a <code>char</code> in the following manner:
* <p>
* <code>(char)(((byte1 & 0xFF) << 8) | (byte2 & 0xFF)</code>
* <code>(char)(((byte1 &amp; 0xFF) &lt;&lt; 8) | (byte2 &amp; 0xFF)</code>
* <p>
* This method can read a <code>char</code> written by an object
* implementing the
@ -539,12 +539,12 @@ public class RandomAccessFile implements DataOutput, DataInput
* significant byte first (i.e., "big endian") regardless of the native
* host byte ordering.
* <p>
* As an example, if <code>byte1</code> and code{byte2</code>
* As an example, if <code>byte1</code> and <code>byte2</code>
* represent the first
* and second byte read from the stream respectively, they will be
* transformed to a <code>short</code> in the following manner:
* <p>
* <code>(short)(((byte1 & 0xFF) << 8) | (byte2 & 0xFF)</code>
* <code>(short)(((byte1 &amp; 0xFF) &lt;&lt; 8) | (byte2 &amp; 0xFF)</code>
* <p>
* The value returned is in the range of -32768 to 32767.
* <p>

View File

@ -48,9 +48,9 @@ import java.security.BasicPermission;
* There are currently two allowable permission names for this class:
* <ul>
* <li><code>enableSubclassImplementation</code> - Allows a subclass to
* override the default serialization behavior of objects.
* override the default serialization behavior of objects.</li>
* <li><code>enableSubstitution</code> - Allows substitution of one object
* for another during serialization or deserialization.
* for another during serialization or deserialization.</li>
* </ul>
*
* @see java.security.BasicPermission

View File

@ -73,12 +73,12 @@ public class StreamTokenizer
* The rules are as follows:
* <ul>
* <li>For a token consisting of a single ordinary character, this is the
* value of that character.
* <li>For a quoted string, this is the value of the quote character
* <li>For a word, this is TT_WORD
* <li>For a number, this is TT_NUMBER
* <li>For the end of the line, this is TT_EOL
* <li>For the end of the stream, this is TT_EOF
* value of that character.</li>
* <li>For a quoted string, this is the value of the quote character</li>
* <li>For a word, this is TT_WORD</li>
* <li>For a number, this is TT_NUMBER</li>
* <li>For the end of the line, this is TT_EOL</li>
* <li>For the end of the stream, this is TT_EOF</li>
* </ul>
*/
public int ttype = TT_NONE;
@ -141,13 +141,13 @@ public class StreamTokenizer
* following manner:
* <ul>
* <li>The values 'A' through 'Z', 'a' through 'z' and 0xA0 through 0xFF
* are initialized as alphabetic
* <li>The values 0x00 through 0x20 are initialized as whitespace
* <li>The values '\'' and '"' are initialized as quote characters
* <li>'/' is a comment character
* <li>Numbers will be parsed
* <li>EOL is not treated as significant
* <li>C and C++ (//) comments are not recognized
* are initialized as alphabetic</li>
* <li>The values 0x00 through 0x20 are initialized as whitespace</li>
* <li>The values '\'' and '"' are initialized as quote characters</li>
* <li>'/' is a comment character</li>
* <li>Numbers will be parsed</li>
* <li>EOL is not treated as significant</li>
* <li>C and C++ (//) comments are not recognized</li>
* </ul>
*
* @param in The <code>Reader</code> to read chars from
@ -251,13 +251,13 @@ public class StreamTokenizer
* returns it. It also can set <code>sval</code> or <code>nval</code>
* as described below. The parsing strategy is as follows:
* <ul>
* <li>Skip any whitespace characters.
* <li>Skip any whitespace characters.</li>
* <li>If a numeric character is encountered, attempt to parse a numeric
* value. Leading '-' characters indicate a numeric only if followed by
* another non-'-' numeric. The value of the numeric token is terminated
* by either the first non-numeric encountered, or the second occurrence of
* '-' or '.'. The token type returned is TT_NUMBER and <code>nval</code>
* is set to the value parsed.
* is set to the value parsed.</li>
* <li>If an alphabetic character is parsed, all subsequent characters
* are read until the first non-alphabetic or non-numeric character is
* encountered. The token type returned is TT_WORD and the value parsed
@ -266,10 +266,10 @@ public class StreamTokenizer
* sequence terminates a word only if EOL signficance has been turned on.
* The start of a comment also terminates a word. Any character with a
* non-alphabetic and non-numeric attribute (such as white space, a quote,
* or a commet) are treated as non-alphabetic and terminate the word.
* or a commet) are treated as non-alphabetic and terminate the word.</li>
* <li>If a comment character is parsed, then all remaining characters on
* the current line are skipped and another token is parsed. Any EOL or
* EOF's encountered are not discarded, but rather terminate the comment.
* EOF's encountered are not discarded, but rather terminate the comment.</li>
* <li>If a quote character is parsed, then all characters up to the
* second occurrence of the same quote character are parsed into a
* <code>String</code>. This <code>String</code> is stored as
@ -280,18 +280,18 @@ public class StreamTokenizer
* (carriage return), \" (double quote), \' (single quote), \\
* (backslash), \XXX (octal esacpe)) are converted to the appropriate
* char values. Invalid esacape sequences are left in untranslated.
* Unicode characters like ('\ u0000') are not recognized.
* Unicode characters like ('\ u0000') are not recognized. </li>
* <li>If the C++ comment sequence "//" is encountered, and the parser
* is configured to handle that sequence, then the remainder of the line
* is skipped and another token is read exactly as if a character with
* the comment attribute was encountered.
* the comment attribute was encountered.</li>
* <li>If the C comment sequence "/*" is encountered, and the parser
* is configured to handle that sequence, then all characters up to and
* including the comment terminator sequence are discarded and another
* token is parsed.
* token is parsed.</li>
* <li>If all cases above are not met, then the character is an ordinary
* character that is parsed as a token by itself. The char encountered
* is returned as the token type.
* is returned as the token type.</li>
* </ul>
*
* @return The token type
@ -635,15 +635,15 @@ public class StreamTokenizer
* 'x' is determined as follows.
* <p>
* <ul>
* <li>If no token has been read, then 'x' is "NOTHING" and 'n' is 0
* <li>If <code>ttype</code> is TT_EOF, then 'x' is "EOF"
* <li>If <code>ttype</code> is TT_EOL, then 'x' is "EOL"
* <li>If <code>ttype</code> is TT_WORD, then 'x' is <code>sval</code>
* <li>If no token has been read, then 'x' is "NOTHING" and 'n' is 0</li>
* <li>If <code>ttype</code> is TT_EOF, then 'x' is "EOF"</li>
* <li>If <code>ttype</code> is TT_EOL, then 'x' is "EOL"</li>
* <li>If <code>ttype</code> is TT_WORD, then 'x' is <code>sval</code></li>
* <li>If <code>ttype</code> is TT_NUMBER, then 'x' is "n=strnval" where
* 'strnval' is <code>String.valueOf(nval)</code>.
* 'strnval' is <code>String.valueOf(nval)</code>.</li>
* <li>If <code>ttype</code> is a quote character, then 'x' is
* <code>sval</code>
* <li>For all other cases, 'x' is <code>ttype</code>
* <code>sval</code></li>
* <li>For all other cases, 'x' is <code>ttype</code></li>
* </ul>
*/
public String toString()

View File

@ -60,6 +60,8 @@ public class StringWriter extends Writer
/**
* This method closes the stream. The contents of the internal buffer
* can still be retrieved, but future writes are not guaranteed to work.
*
* @exception IOException If an error orrurs.
*/
public void close () throws IOException
{

View File

@ -81,7 +81,7 @@ public class WriteAbortedException extends ObjectStreamException
/**
* This method returns a message indicating what went wrong, in this
* format:
* <code>super.getMessage() + (detail == null ? "" : "; " + detail)<code>.
* <code>super.getMessage() + (detail == null ? "" : "; " + detail)</code>.
*
* @return the chained message
*/

View File

@ -75,8 +75,8 @@ public abstract class Writer
* 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
* @param lock The <code>Object</code> to use for synchronizing critical
* sections
*/
protected Writer(Object lock)
{
@ -157,7 +157,7 @@ public abstract class Writer
*
* @param str The <code>String</code> whose chars are to be written.
*
* @param IOException If an error occurs
* @exception IOException If an error occurs
*/
public void write(String str) throws IOException
{