From ffe4ebba87d78d4da242adb6e95d2976bd796d91 Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Mon, 24 Mar 2003 08:27:28 +0000 Subject: DataInputStream.java (): Wrapped documentation line. 2003-03-24 Michael Koch * java/io/DataInputStream.java (): Wrapped documentation line. (): Fixed @return tag. * java/io/DataOutputStream.java (written): Moved to top of class. (all methods): Merged documentation from classpath. * java/io/File.java: Merged copyright year with classpath. * java/io/FileInputStream.java (all methods): Merged documentation from classpath. * java/io/LineNumberReader.java (getLineNumber): Fixed @return tag. * java/io/ObjectInputStream.java. Reformatted. * java/io/ObjectOutputStream.java: Reformatted, fixed some @see tags. * java/io/OutputStreamWriter.java: Deleted empty line. * java/io/Writer.java: Reformatted. From-SVN: r64780 --- libjava/java/io/DataInputStream.java | 5 +- libjava/java/io/DataOutputStream.java | 192 ++++++++++++++++++- libjava/java/io/File.java | 2 +- libjava/java/io/FileInputStream.java | 173 ++++++++++++++++- libjava/java/io/LineNumberReader.java | 2 +- libjava/java/io/ObjectInputStream.java | 275 +++++++++++++-------------- libjava/java/io/ObjectOutputStream.java | 325 ++++++++++++++++---------------- libjava/java/io/OutputStreamWriter.java | 1 - libjava/java/io/Writer.java | 190 ++++++++----------- 9 files changed, 728 insertions(+), 437 deletions(-) (limited to 'libjava/java/io') diff --git a/libjava/java/io/DataInputStream.java b/libjava/java/io/DataInputStream.java index 626da90..5f8c541 100644 --- a/libjava/java/io/DataInputStream.java +++ b/libjava/java/io/DataInputStream.java @@ -596,7 +596,8 @@ public class DataInputStream extends FilterInputStream implements DataInput * character encoding, then they would be converted to a Java * char like so: *

- * (char)(((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) | (byte3 & 0x3F)) + * (char)(((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) | + * (byte3 & 0x3F)) *

* Note that all characters are encoded in the method that requires * the fewest number of bytes with the exception of the character @@ -608,7 +609,7 @@ public class DataInputStream extends FilterInputStream implements DataInput * This method can read data that was written by an object implementing the * writeUTF() method in DataOutput * - * @returns The String read + * @return The String read * * @exception EOFException If end of file is reached before reading * the String diff --git a/libjava/java/io/DataOutputStream.java b/libjava/java/io/DataOutputStream.java index 61a00f5..8fe9bbe 100644 --- a/libjava/java/io/DataOutputStream.java +++ b/libjava/java/io/DataOutputStream.java @@ -38,40 +38,90 @@ exception statement from your version. */ package java.io; -/** - * @author Tom Tromey - * @date September 24, 1998 - */ - /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 * "The Java Language Specification", ISBN 0-201-63451-1 * Status: Complete to version 1.1. */ +/** + * This class provides a mechanism for writing primitive Java datatypes + * to an OutputStream in a portable way. Data written to + * a stream using this class can be read back in using the + * DataInputStream class on any platform. + * + * @see DataInputStream + * + * @author Aaron M. Renn + * @author Tom Tromey + */ public class DataOutputStream extends FilterOutputStream implements DataOutput { + /** + * This is the total number of bytes that have been written to the + * stream by this object instance. + */ + protected int written; + + /** + * This method initializes an instance of DataOutputStream to + * write its data to the specified underlying OutputStream + * + * @param out The subordinate OutputStream to which this + * object will write + */ public DataOutputStream (OutputStream out) { super (out); written = 0; } + /** + * This method flushes any unwritten bytes to the underlying stream. + * + * @exception IOException If an error occurs. + */ public void flush () throws IOException { out.flush(); } + /** + * This method returns the total number of bytes that have been written to + * the underlying output stream so far. This is the value of the + * written instance variable + * + * @return The number of bytes written to the stream. + */ public final int size () { return written; } + /** + * This method writes the specified byte (passed as an int) + * to the underlying output stream. + * + * @param b The byte to write, passed as an int. + * + * @exception IOException If an error occurs. + */ public synchronized void write (int b) throws IOException { out.write(b); ++written; } + /** + * This method writes len bytes from the specified byte array + * buf starting at position offset into the + * buffer to the underlying output stream. + * + * @param buf The byte array to write from. + * @param offset The index into the byte array to start writing from. + * @param len The number of bytes to write. + * + * @exception IOException If an error occurs. + */ public synchronized void write (byte[] b, int off, int len) throws IOException, NullPointerException, IndexOutOfBoundsException { @@ -79,28 +129,72 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput written += len; } + /** + * This method writes a Java boolean to the underlying output + * stream. For a value of true, 1 is written to the stream. + * For a value of false, 0 is written. + * + * @param b The boolean value to write to the stream + * + * @exception IOException If an error occurs + */ public final void writeBoolean (boolean v) throws IOException { write (v ? 1 : 0); } + /** + * This method writes a Java byte value to the underlying + * output stream. + * + * @param b The byte to write to the stream, passed as + * the low eight bits of an int. + * + * @exception IOException If an error occurs + */ public final void writeByte (int v) throws IOException { write (v & 0xff); } + /** + * This method writes a Java short to the stream, high byte + * first. This method requires two bytes to encode the value. + * + * @param s The short value to write to the stream, + * passed as an int. + * + * @exception IOException If an error occurs + */ public final void writeShort (int v) throws IOException { write ((byte) (0xff & (v >> 8))); write ((byte) (0xff & v)); } + /** + * This method writes a single char value to the stream, + * high byte first. + * + * @param c The char value to write, + * passed as an int. + * + * @exception IOException If an error occurs + */ public final void writeChar (int v) throws IOException { write ((byte) (0xff & (v >> 8))); write ((byte) (0xff & v)); } + /** + * This method writes a Java int to the stream, high bytes + * first. This method requires four bytes to encode the value. + * + * @param i The int value to write to the stream. + * + * @exception IOException If an error occurs + */ public final void writeInt (int v) throws IOException { write ((byte) (0xff & (v >> 24))); @@ -109,6 +203,14 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput write ((byte) (0xff & v)); } + /** + * This method writes a Java long to the stream, high bytes + * first. This method requires eight bytes to encode the value. + * + * @param l The long value to write to the stream. + * + * @exception IOException If an error occurs + */ public final void writeLong (long v) throws IOException { write ((byte) (0xff & (v >> 56))); @@ -121,16 +223,55 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput write ((byte) (0xff & v)); } + /** + * This method writes a Java float value to the stream. This + * value is written by first calling the method + * Float.floatToIntBits + * to retrieve an int representing the floating point number, + * then writing this int value to the stream exactly the same + * as the writeInt() method does. + * + * @param f The floating point number to write to the stream. + * + * @exception IOException If an error occurs + * + * @see writeInt + */ public final void writeFloat (float v) throws IOException { writeInt (Float.floatToIntBits(v)); } + /** + * This method writes a Java double value to the stream. This + * value is written by first calling the method + * Double.doubleToLongBits + * to retrieve an long representing the floating point number, + * then writing this long value to the stream exactly the same + * as the writeLong() method does. + * + * @param d The double precision floating point number to write to + * the stream. + * + * @exception IOException If an error occurs + * + * @see writeLong + */ public final void writeDouble (double v) throws IOException { writeLong (Double.doubleToLongBits(v)); } + /** + * This method writes all the bytes in a String out to the + * stream. One byte is written for each character in the + * String. + * The high eight bits of each character are discarded. + * + * @param s The String to write to the stream + * + * @exception IOException If an error occurs + */ public final void writeBytes (String s) throws IOException { int len = s.length(); @@ -138,6 +279,15 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput writeByte (s.charAt(i)); } + /** + * This method writes all the characters in a String to the + * stream. There will be two bytes for each character value. The high + * byte of the character will be written first. + * + * @param s The String to write to the stream. + * + * @exception IOException If an error occurs + */ public final void writeChars (String s) throws IOException { int len = s.length(); @@ -145,6 +295,33 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput writeChar (s.charAt(i)); } + /** + * This method writes a Java String to the stream in a modified + * UTF-8 format. First, two bytes are written to the stream indicating the + * number of bytes to follow. Note that this is the number of bytes in the + * encoded String not the String length. Next + * come the encoded characters. Each character in the String + * is encoded as either one, two or three bytes. For characters in the + * range of \u0001 to <\u007F>, one byte is used. The character + * value goes into bits 0-7 and bit eight is 0. For characters in the range + * of \u0080 to \u007FF, two bytes are used. Bits + * 6-10 of the character value are encoded bits 0-4 of the first byte, with + * the high bytes having a value of "110". Bits 0-5 of the character value + * are stored in bits 0-5 of the second byte, with the high bits set to + * "10". This type of encoding is also done for the null character + * \u0000. This eliminates any C style NUL character values + * in the output. All remaining characters are stored as three bytes. + * Bits 12-15 of the character value are stored in bits 0-3 of the first + * byte. The high bits of the first bytes are set to "1110". Bits 6-11 + * of the character value are stored in bits 0-5 of the second byte. The + * high bits of the second byte are set to "10". And bits 0-5 of the + * character value are stored in bits 0-5 of byte three, with the high bits + * of that byte set to "10". + * + * @param s The String to write to the output in UTF format + * + * @exception IOException If an error occurs + */ public final void writeUTF (String s) throws IOException { int len = s.length(); @@ -188,6 +365,5 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput } } - // Number of bytes written so far. - protected int written; -} +} // class DataOutputStream + diff --git a/libjava/java/io/File.java b/libjava/java/io/File.java index eb457b3..e0aaaf9 100644 --- a/libjava/java/io/File.java +++ b/libjava/java/io/File.java @@ -1,5 +1,5 @@ /* File.java -- Class representing a file on disk - Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/libjava/java/io/FileInputStream.java b/libjava/java/io/FileInputStream.java index ae738af..63390ec 100644 --- a/libjava/java/io/FileInputStream.java +++ b/libjava/java/io/FileInputStream.java @@ -3,6 +3,11 @@ This file is part of GNU Classpath. +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU @@ -36,23 +41,43 @@ package java.io; import java.nio.channels.FileChannel; import gnu.java.nio.FileChannelImpl; -/** - * @author Warren Levy - * @date October 28, 1998. - */ /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 * "The Java Language Specification", ISBN 0-201-63451-1 * plus online API docs for JDK 1.2 beta from http://www.javasoft.com. * Status: Believed complete and correct. */ +/** + * This class is a stream that reads its bytes from a file. + * + * @author Aaron M. Renn + * @author Warren Levy + * @date October 28, 1998. + */ public class FileInputStream extends InputStream { - /* Contains the file descriptor for referencing the actual file. */ + /** + * This is the native file handle for the file this stream is reading from + */ private FileDescriptor fd; - private FileChannel ch; + private FileChannel ch; /* cached associated file-channel */ + /** + * This method initializes a FileInputStream to read from the + * specified named file. A security check is first made to determine + * whether or not access to this file is allowed. This is done by + * calling the checkRead() method of the + * SecurityManager + * (if one exists) with the name of this file. An exception is thrown + * if reading is not allowed. If the file does not exist, an exception + * is also thrown. + * + * @param name The name of the file this stream should read from + * + * @exception SecurityException If read access to the file is not allowed + * @exception FileNotFoundException If the file does not exist. + */ public FileInputStream(String name) throws FileNotFoundException { SecurityManager s = System.getSecurityManager(); @@ -61,24 +86,83 @@ public class FileInputStream extends InputStream fd = new FileDescriptor(name, FileDescriptor.READ); } + /** + * This method initializes a FileInputStream to read from the + * specified File object. A security check is first + * made to determine + * whether or not access to this file is allowed. This is done by + * calling the checkRead() method of the + * SecurityManager + * (if one exists) with the name of this file. An exception is thrown + * if reading is not allowed. If the file does not exist, an exception + * is also thrown. + * + * @param file The File object this stream should read from + * + * @exception SecurityException If read access to the file is not allowed + * @exception FileNotFoundException If the file does not exist. + */ public FileInputStream(File file) throws FileNotFoundException { this(file.getPath()); } + /** + * This method initializes a FileInputStream to read from the + * specified FileDescriptor object. A security + * check is first made to + * determine whether or not access to this file is allowed. This is done by + * calling the checkRead() method of the + * SecurityManager + * (if one exists) with the specified FileDescriptor + * An exception is + * thrown if reading is not allowed. + * + * @param fd The FileDescriptor object this stream + * should read from + * + * @exception SecurityException If read access to the file is not allowed + */ public FileInputStream(FileDescriptor fdObj) { SecurityManager s = System.getSecurityManager(); if (s != null) s.checkRead(fdObj); + fd = fdObj; } + /** + * This method returns the number of bytes that can be read from this + * stream before a read can block. A return of 0 indicates that blocking + * might (or might not) occur on the very next read attempt. + *

+ * This method returns the number of unread bytes remaining in the file if + * the descriptor being read from is an actual file. If this method is + * reading from a ''special'' file such a the standard input, this method + * will return the appropriate value for the stream being read. + *

+ * Be aware that reads on plain files that do not reside locally might + * possibly block even if this method says they should not. For example, + * a remote server might crash, preventing an NFS mounted file from being + * read. + * + * @return The number of bytes that can be read before blocking could occur + * + * @exception IOException If an error occurs + */ public int available() throws IOException { return fd.available(); } + /** + * This method closes the stream. Any futher attempts to read from the + * stream will likely generate an IOException since the underlying file + * will be closed. + * + * @exception IOException If an error occurs. + */ public void close() throws IOException { if (fd.valid()) @@ -91,6 +175,15 @@ public class FileInputStream extends InputStream // mentioned in the JCL. } + /** + * This method returns a FileDescriptor object representing the + * underlying native file handle of the file this stream is reading + * from + * + * @return A FileDescriptor for this stream + * + * @exception IOException If an error occurs + */ public final FileDescriptor getFD() throws IOException { if (!fd.valid()) @@ -98,16 +191,63 @@ public class FileInputStream extends InputStream return fd; } + /** + * This method reads an unsigned byte from the input stream and returns it + * as an int in the range of 0-255. This method also will return -1 if + * the end of the stream has been reached. + *

+ * This method will block until the byte can be read. + * + * @return The byte read or -1 if end of stream + * + * @exception IOException If an error occurs + */ public int read() throws IOException { return fd.read(); } + /** + * This method reads bytes from a stream and stores them into a caller + * supplied buffer. This method attempts to completely fill the buffer, + * but can return before doing so. The actual number of bytes read is + * returned as an int. A -1 is returned to indicate the end of the stream. + *

+ * This method will block until some data can be read. + *

+ * This method operates by calling an overloaded read method like so: + * read(buf, 0, buf.length) + * + * @param buf The buffer into which the bytes read will be stored. + * + * @return The number of bytes read or -1 if end of stream. + * + * @exception IOException If an error occurs. + */ public int read(byte[] b) throws IOException { return fd.read(b, 0, b.length); } + /** + * This method read bytes from a stream and stores them into a caller + * supplied buffer. It starts storing the data at index + * offset into + * the buffer and attempts to read len bytes. This method can + * return before reading the number of bytes requested. The actual number + * of bytes read is returned as an int. A -1 is returned to indicate the + * end of the stream. + *

+ * This method will block until some data can be read. + * + * @param buf 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 + * + * @return The actual number of bytes read, or -1 if end of stream. + * + * @exception IOException If an error occurs. + */ public int read(byte[] b, int off, int len) throws IOException { if (off < 0 || len < 0 || off + len > b.length) @@ -116,6 +256,17 @@ public class FileInputStream extends InputStream return fd.read(b, off, len); } + /** + * This method skips the specified number of bytes in the stream. It + * returns the actual number of bytes skipped, which may be less than the + * requested amount. + *

+ * @param numBytes The requested number of bytes to skip + * + * @return The actual number of bytes skipped. + * + * @exception IOException If an error occurs + */ public long skip(long n) throws IOException { long startPos = fd.getFilePointer(); @@ -123,6 +274,12 @@ public class FileInputStream extends InputStream return endPos - startPos; } + /** + * This method creates a java.nio.channels.FileChannel. + * Nio does not allow one to create a file channel directly. + * A file channel must be created by first creating an instance of + * Input/Output/RandomAccessFile and invoking the getChannel() method on it. + */ public FileChannel getChannel () { synchronized (this) @@ -133,4 +290,6 @@ public class FileInputStream extends InputStream return ch; } } -} + +} // class FileInputStream + diff --git a/libjava/java/io/LineNumberReader.java b/libjava/java/io/LineNumberReader.java index 8ef670d..73b3b90 100644 --- a/libjava/java/io/LineNumberReader.java +++ b/libjava/java/io/LineNumberReader.java @@ -100,7 +100,7 @@ public class LineNumberReader extends BufferedReader /** * This method returns the current line number * - * @returns The current line number + * @return The current line number */ public int getLineNumber() { diff --git a/libjava/java/io/ObjectInputStream.java b/libjava/java/io/ObjectInputStream.java index 7df96e5..2302609 100644 --- a/libjava/java/io/ObjectInputStream.java +++ b/libjava/java/io/ObjectInputStream.java @@ -57,19 +57,19 @@ public class ObjectInputStream extends InputStream implements ObjectInput, ObjectStreamConstants { /** - Creates a new ObjectInputStream that will do all of - its reading from in. This method also checks - the stream by reading the header information (stream magic number - and stream version). - - @exception IOException Reading stream header from underlying - stream cannot be completed. - - @exception StreamCorruptedException An invalid stream magic - number or stream version was read from the stream. - - @see readStreamHeader () - */ + * Creates a new ObjectInputStream that will do all of + * its reading from in. This method also checks + * the stream by reading the header information (stream magic number + * and stream version). + * + * @exception IOException Reading stream header from underlying + * stream cannot be completed. + * + * @exception StreamCorruptedException An invalid stream magic + * number or stream version was read from the stream. + * + * @see #readStreamHeader() + */ public ObjectInputStream (InputStream in) throws IOException, StreamCorruptedException { @@ -104,20 +104,20 @@ public class ObjectInputStream extends InputStream /** - Returns the next deserialized object read from the underlying stream. - - This method can be overriden by a class by implementing - private void readObject (ObjectInputStream). - - If an exception is thrown from this method, the stream is left in - an undefined state. - - @exception ClassNotFoundException The class that an object being - read in belongs to cannot be found. - - @exception IOException Exception from underlying - InputStream. - */ + * Returns the next deserialized object read from the underlying stream. + * + * This method can be overriden by a class by implementing + * private void readObject (ObjectInputStream). + * + * If an exception is thrown from this method, the stream is left in + * an undefined state. + * + * @exception ClassNotFoundException The class that an object being + * read in belongs to cannot be found. + * + * @exception IOException Exception from underlying + * InputStream. + */ public final Object readObject () throws ClassNotFoundException, IOException { if (this.useSubclassMethod) @@ -452,24 +452,24 @@ public class ObjectInputStream extends InputStream } /** - Reads the current objects non-transient, non-static fields from - the current class from the underlying output stream. - - This method is intended to be called from within a object's - private void readObject (ObjectInputStream) - method. - - @exception ClassNotFoundException The class that an object being - read in belongs to cannot be found. - - @exception NotActiveException This method was called from a - context other than from the current object's and current class's - private void readObject (ObjectInputStream) - method. - - @exception IOException Exception from underlying - OutputStream. - */ + * Reads the current objects non-transient, non-static fields from + * the current class from the underlying output stream. + * + * This method is intended to be called from within a object's + * private void readObject (ObjectInputStream) + * method. + * + * @exception ClassNotFoundException The class that an object being + * read in belongs to cannot be found. + * + * @exception NotActiveException This method was called from a + * context other than from the current object's and current class's + * private void readObject (ObjectInputStream) + * method. + * + * @exception IOException Exception from underlying + * OutputStream. + */ public void defaultReadObject () throws ClassNotFoundException, IOException, NotActiveException { @@ -488,23 +488,23 @@ public class ObjectInputStream extends InputStream /** - Registers a ObjectInputValidation to be carried out - on the object graph currently being deserialized before it is - returned to the original caller of readObject (). - The order of validation for multiple - ObjectInputValidations can be controled using - priority. Validators with higher priorities are - called first. - - @see java.io.ObjectInputValidation - - @exception InvalidObjectException validator is - null - - @exception NotActiveException an attempt was made to add a - validator outside of the readObject method of the - object currently being deserialized - */ + * Registers a ObjectInputValidation to be carried out + * on the object graph currently being deserialized before it is + * returned to the original caller of readObject (). + * The order of validation for multiple + * ObjectInputValidations can be controled using + * priority. Validators with higher priorities are + * called first. + * + * @see java.io.ObjectInputValidation + * + * @exception InvalidObjectException validator is + * null + * + * @exception NotActiveException an attempt was made to add a + * validator outside of the readObject method of the + * object currently being deserialized + */ public void registerValidation (ObjectInputValidation validator, int priority) throws InvalidObjectException, NotActiveException @@ -521,21 +521,21 @@ public class ObjectInputStream extends InputStream /** - Called when a class is being deserialized. This is a hook to - allow subclasses to read in information written by the - annotateClass (Class) method of an - ObjectOutputStream. - - This implementation looks up the active call stack for a - ClassLoader; if a ClassLoader is found, - it is used to load the class associated with osc, - otherwise, the default system ClassLoader is used. - - @exception IOException Exception from underlying - OutputStream. - - @see java.io.ObjectOutputStream#annotateClass (java.lang.Class) - */ + * Called when a class is being deserialized. This is a hook to + * allow subclasses to read in information written by the + * annotateClass (Class) method of an + * ObjectOutputStream. + * + * This implementation looks up the active call stack for a + * ClassLoader; if a ClassLoader is found, + * it is used to load the class associated with osc, + * otherwise, the default system ClassLoader is used. + * + * @exception IOException Exception from underlying + * OutputStream. + * + * @see java.io.ObjectOutputStream#annotateClass (java.lang.Class) + */ protected Class resolveClass (ObjectStreamClass osc) throws ClassNotFoundException, IOException { @@ -555,18 +555,18 @@ public class ObjectInputStream extends InputStream } /** - Allows subclasses to resolve objects that are read from the - stream with other objects to be returned in their place. This - method is called the first time each object is encountered. - - This method must be enabled before it will be called in the - serialization process. - - @exception IOException Exception from underlying - OutputStream. - - @see enableResolveObject (boolean) - */ + * Allows subclasses to resolve objects that are read from the + * stream with other objects to be returned in their place. This + * method is called the first time each object is encountered. + * + * This method must be enabled before it will be called in the + * serialization process. + * + * @exception IOException Exception from underlying + * OutputStream. + * + * @see #enableResolveObject(boolean) + */ protected Object resolveObject (Object obj) throws IOException { return obj; @@ -600,13 +600,13 @@ public class ObjectInputStream extends InputStream } /** - If enable is true and this object is - trusted, then resolveObject (Object) will be called - in subsequent calls to readObject (Object). - Otherwise, resolveObject (Object) will not be called. - - @exception SecurityException This class is not trusted. - */ + * If enable is true and this object is + * trusted, then resolveObject (Object) will be called + * in subsequent calls to readObject (Object). + * Otherwise, resolveObject (Object) will not be called. + * + * @exception SecurityException This class is not trusted. + */ protected boolean enableResolveObject (boolean enable) throws SecurityException { @@ -622,16 +622,15 @@ public class ObjectInputStream extends InputStream return old_val; } - /** - Reads stream magic and stream version information from the - underlying stream. - - @exception IOException Exception from underlying stream. - - @exception StreamCorruptedException An invalid stream magic - number or stream version was read from the stream. - */ + * Reads stream magic and stream version information from the + * underlying stream. + * + * @exception IOException Exception from underlying stream. + * + * @exception StreamCorruptedException An invalid stream magic + * number or stream version was read from the stream. + */ protected void readStreamHeader () throws IOException, StreamCorruptedException { @@ -644,7 +643,6 @@ public class ObjectInputStream extends InputStream throw new StreamCorruptedException ("Invalid stream version number"); } - public int read () throws IOException { if (this.readDataFromBlock) @@ -769,9 +767,9 @@ public class ObjectInputStream extends InputStream } /** - @deprecated - @see java.io.DataInputStream#readLine () - */ + * @deprecated + * @see java.io.DataInputStream#readLine () + */ public String readLine () throws IOException { return this.dataInputStream.readLine (); @@ -782,13 +780,12 @@ public class ObjectInputStream extends InputStream return this.dataInputStream.readUTF (); } - /** - This class allows a class to specify exactly which fields should - be read, and what values should be read for these fields. - - XXX: finish up comments - */ + * This class allows a class to specify exactly which fields should + * be read, and what values should be read for these fields. + * + * XXX: finish up comments + */ public static abstract class GetField { public abstract ObjectStreamClass getObjectStreamClass (); @@ -1018,18 +1015,17 @@ public class ObjectInputStream extends InputStream } - /** - Protected constructor that allows subclasses to override - deserialization. This constructor should be called by subclasses - that wish to override readObject (Object). This - method does a security check NOTE: currently not - implemented, then sets a flag that informs - readObject (Object) to call the subclasses - readObjectOverride (Object) method. - - @see readObjectOverride (Object) - */ + * Protected constructor that allows subclasses to override + * deserialization. This constructor should be called by subclasses + * that wish to override readObject (Object). This + * method does a security check NOTE: currently not + * implemented, then sets a flag that informs + * readObject (Object) to call the subclasses + * readObjectOverride (Object) method. + * + * @see #readObjectOverride() + */ protected ObjectInputStream () throws IOException, SecurityException { @@ -1039,23 +1035,21 @@ public class ObjectInputStream extends InputStream this.useSubclassMethod = true; } - /** - This method allows subclasses to override the default - de serialization mechanism provided by - ObjectInputStream. To make this method be used for - writing objects, subclasses must invoke the 0-argument - constructor on this class from their constructor. - - @see ObjectInputStream () - */ + * This method allows subclasses to override the default + * de serialization mechanism provided by + * ObjectInputStream. To make this method be used for + * writing objects, subclasses must invoke the 0-argument + * constructor on this class from their constructor. + * + * @see #ObjectInputStream() + */ protected Object readObjectOverride () throws ClassNotFoundException, IOException, OptionalDataException { throw new IOException ("Subclass of ObjectInputStream must implement readObjectOverride"); } - // assigns the next availible handle to OBJ private int assignNewHandle (Object obj) { @@ -1064,7 +1058,6 @@ public class ObjectInputStream extends InputStream return this.nextOID++; } - private Object processResolution (Object obj, int handle) throws IOException { @@ -1099,20 +1092,17 @@ public class ObjectInputStream extends InputStream return obj; } - private void clearHandles () { this.objectLookupTable.clear (); this.nextOID = baseWireHandle; } - private void readNextBlock () throws IOException { readNextBlock (this.realInputStream.readByte ()); } - private void readNextBlock (byte marker) throws IOException { if (marker == TC_BLOCKDATA) @@ -1139,7 +1129,6 @@ public class ObjectInputStream extends InputStream this.blockDataPosition = 0; } - private void readArrayElements (Object array, Class clazz) throws ClassNotFoundException, IOException { @@ -1210,7 +1199,6 @@ public class ObjectInputStream extends InputStream } } - private void readFields (Object obj, ObjectStreamClass stream_osc) throws ClassNotFoundException, IOException { @@ -1374,7 +1362,6 @@ public class ObjectInputStream extends InputStream return oldmode; } - // returns a new instance of REAL_CLASS that has been constructed // only to the level of CONSTRUCTOR_CLASS (a super class of REAL_CLASS) private Object newObject (Class real_class, Class constructor_class) @@ -1391,7 +1378,6 @@ public class ObjectInputStream extends InputStream } } - // runs all registered ObjectInputValidations in prioritized order // on OBJ private void invokeValidators () throws InvalidObjectException @@ -1411,7 +1397,6 @@ public class ObjectInputStream extends InputStream } } - // this native method is used to get access to the protected method // of the same name in SecurityManger private static ClassLoader currentClassLoader (SecurityManager sm) diff --git a/libjava/java/io/ObjectOutputStream.java b/libjava/java/io/ObjectOutputStream.java index a051a96..afa0acb 100644 --- a/libjava/java/io/ObjectOutputStream.java +++ b/libjava/java/io/ObjectOutputStream.java @@ -49,86 +49,85 @@ import gnu.java.lang.reflect.TypeSignature; import gnu.classpath.Configuration; /** - An ObjectOutputStream can be used to write objects - as well as primitive data in a platform-independent manner to an - OutputStream. - - The data produced by an ObjectOutputStream can be read - and reconstituted by an ObjectInputStream. - - writeObject (Object) is used to write Objects, the - write<type> methods are used to write primitive - data (as in DataOutputStream). Strings can be written - as objects or as primitive data. - - Not all objects can be written out using an - ObjectOutputStream. Only those objects that are an - instance of java.io.Serializable can be written. - - Using default serialization, information about the class of an - object is written, all of the non-transient, non-static fields of - the object are written, if any of these fields are objects, they are - written out in the same manner. - - An object is only written out the first time it is encountered. If - the object is encountered later, a reference to it is written to - the underlying stream. Thus writing circular object graphs - does not present a problem, nor are relationships between objects - in a graph lost. - - Example usage: -

-   Hashtable map = new Hashtable ();
-   map.put ("one", new Integer (1));
-   map.put ("two", new Integer (2));
-
-   ObjectOutputStream oos =
-   new ObjectOutputStream (new FileOutputStream ("numbers"));
-   oos.writeObject (map);
-   oos.close ();
-
-   ObjectInputStream ois =
-   new ObjectInputStream (new FileInputStream ("numbers"));
-   Hashtable newmap = (Hashtable)ois.readObject ();
-
-   System.out.println (newmap);
-   
- - The default serialization can be overriden in two ways. - - By defining a method private void - writeObject (ObjectOutputStream), a class can dictate exactly - how information about itself is written. - defaultWriteObject () may be called from this method to - carry out default serialization. This method is not - responsible for dealing with fields of super-classes or subclasses. - - By implementing java.io.Externalizable. This gives - the class complete control over the way it is written to the - stream. If this approach is used the burden of writing superclass - and subclass data is transfered to the class implementing - java.io.Externalizable. - - @see java.io.DataOutputStream - @see java.io.Externalizable - @see java.io.ObjectInputStream - @see java.io.Serializable - @see XXX: java serialization spec -*/ + * An ObjectOutputStream can be used to write objects + * as well as primitive data in a platform-independent manner to an + * OutputStream. + * + * The data produced by an ObjectOutputStream can be read + * and reconstituted by an ObjectInputStream. + * + * writeObject (Object) is used to write Objects, the + * write<type> methods are used to write primitive + * data (as in DataOutputStream). Strings can be written + * as objects or as primitive data. + * + * Not all objects can be written out using an + * ObjectOutputStream. Only those objects that are an + * instance of java.io.Serializable can be written. + * + * Using default serialization, information about the class of an + * object is written, all of the non-transient, non-static fields of + * the object are written, if any of these fields are objects, they are + * written out in the same manner. + * + * An object is only written out the first time it is encountered. If + * the object is encountered later, a reference to it is written to + * the underlying stream. Thus writing circular object graphs + * does not present a problem, nor are relationships between objects + * in a graph lost. + * + * Example usage: + *
+ * Hashtable map = new Hashtable ();
+ * map.put ("one", new Integer (1));
+ * map.put ("two", new Integer (2));
+ *
+ * ObjectOutputStream oos =
+ * new ObjectOutputStream (new FileOutputStream ("numbers"));
+ * oos.writeObject (map);
+ * oos.close ();
+ *
+ * ObjectInputStream ois =
+ * new ObjectInputStream (new FileInputStream ("numbers"));
+ * Hashtable newmap = (Hashtable)ois.readObject ();
+ *
+ * System.out.println (newmap);
+ * 
+ * + * The default serialization can be overriden in two ways. + * + * By defining a method private void + * writeObject (ObjectOutputStream), a class can dictate exactly + * how information about itself is written. + * defaultWriteObject () may be called from this method to + * carry out default serialization. This method is not + * responsible for dealing with fields of super-classes or subclasses. + * + * By implementing java.io.Externalizable. This gives + * the class complete control over the way it is written to the + * stream. If this approach is used the burden of writing superclass + * and subclass data is transfered to the class implementing + * java.io.Externalizable. + * + * @see java.io.DataOutputStream + * @see java.io.Externalizable + * @see java.io.ObjectInputStream + * @see java.io.Serializable + */ public class ObjectOutputStream extends OutputStream implements ObjectOutput, ObjectStreamConstants { /** - Creates a new ObjectOutputStream that will do all of - its writing onto out. This method also initializes - the stream by writing the header information (stream magic number - and stream version). - - @exception IOException Writing stream header to underlying - stream cannot be completed. - - @see writeStreamHeader () - */ + * Creates a new ObjectOutputStream that will do all of + * its writing onto out. This method also initializes + * the stream by writing the header information (stream magic number + * and stream version). + * + * @exception IOException Writing stream header to underlying + * stream cannot be completed. + * + * @see #writeStreamHeader() + */ public ObjectOutputStream (OutputStream out) throws IOException { realOutput = new DataOutputStream (out); @@ -145,26 +144,25 @@ public class ObjectOutputStream extends OutputStream writeStreamHeader (); } - /** - Writes a representation of obj to the underlying - output stream by writing out information about its class, then - writing out each of the objects non-transient, non-static - fields. If any of these fields are other objects, - they are written out in the same manner. - - This method can be overriden by a class by implementing - private void writeObject (ObjectOutputStream). - - If an exception is thrown from this method, the stream is left in - an undefined state. - - @exception NotSerializableException An attempt was made to - serialize an Object that is not serializable. - - @exception IOException Exception from underlying - OutputStream. - */ + * Writes a representation of obj to the underlying + * output stream by writing out information about its class, then + * writing out each of the objects non-transient, non-static + * fields. If any of these fields are other objects, + * they are written out in the same manner. + * + * This method can be overriden by a class by implementing + * private void writeObject (ObjectOutputStream). + * + * If an exception is thrown from this method, the stream is left in + * an undefined state. + * + * @exception NotSerializableException An attempt was made to + * serialize an Object that is not serializable. + * + * @exception IOException Exception from underlying + * OutputStream. + */ public final void writeObject (Object obj) throws IOException { if (useSubclassMethod) @@ -494,7 +492,7 @@ public class ObjectOutputStream extends OutputStream @exception IOException if version is not a valid protocol - @see setDefaultProtocolVersion (int) + @see #setDefaultProtocolVersion(int) */ public void useProtocolVersion (int version) throws IOException { @@ -517,7 +515,7 @@ public class ObjectOutputStream extends OutputStream @exception IOException if version is not a valid protocol - @see useProtocolVersion (int) + @see #useProtocolVersion(int) */ public static void setDefaultProtocolVersion (int version) throws IOException @@ -538,7 +536,7 @@ public class ObjectOutputStream extends OutputStream @exception IOException Exception from underlying OutputStream. - @see java.io.ObjectInputStream#resolveClass (java.io.ObjectStreamClass) + @see ObjectInputStream#resolveClass(java.io.ObjectStreamClass) */ protected void annotateClass (Class cl) throws IOException {} @@ -558,7 +556,7 @@ public class ObjectOutputStream extends OutputStream @exception IOException Exception from underlying OutputStream. - @see enableReplaceObject (boolean) + @see #enableReplaceObject(boolean) */ protected Object replaceObject (Object obj) throws IOException { @@ -606,16 +604,16 @@ public class ObjectOutputStream extends OutputStream /** - Protected constructor that allows subclasses to override - serialization. This constructor should be called by subclasses - that wish to override writeObject (Object). This - method does a security check NOTE: currently not - implemented, then sets a flag that informs - writeObject (Object) to call the subclasses - writeObjectOverride (Object) method. - - @see writeObjectOverride (Object) - */ + * Protected constructor that allows subclasses to override + * serialization. This constructor should be called by subclasses + * that wish to override writeObject (Object). This + * method does a security check NOTE: currently not + * implemented, then sets a flag that informs + * writeObject (Object) to call the subclasses + * writeObjectOverride (Object) method. + * + * @see #writeObjectOverride(Object) + */ protected ObjectOutputStream () throws IOException, SecurityException { SecurityManager sec_man = System.getSecurityManager (); @@ -626,17 +624,17 @@ public class ObjectOutputStream extends OutputStream /** - This method allows subclasses to override the default - serialization mechanism provided by - ObjectOutputStream. To make this method be used for - writing objects, subclasses must invoke the 0-argument - constructor on this class from there constructor. - - @see ObjectOutputStream () - - @exception NotActiveException Subclass has arranged for this - method to be called, but did not implement this method. - */ + * This method allows subclasses to override the default + * serialization mechanism provided by + * ObjectOutputStream. To make this method be used for + * writing objects, subclasses must invoke the 0-argument + * constructor on this class from there constructor. + * + * @see #ObjectOutputStream() + * + * @exception NotActiveException Subclass has arranged for this + * method to be called, but did not implement this method. + */ protected void writeObjectOverride (Object obj) throws NotActiveException, IOException { @@ -645,8 +643,8 @@ public class ObjectOutputStream extends OutputStream /** - @see java.io.DataOutputStream#write (int) - */ + * @see DataOutputStream#write(int) + */ public void write (int data) throws IOException { if (writeDataAsBlocks) @@ -662,8 +660,8 @@ public class ObjectOutputStream extends OutputStream /** - @see java.io.DataOutputStream#write (byte[]) - */ + * @see DataOutputStream#write(byte[]) + */ public void write (byte[] b) throws IOException { write (b, 0, b.length); @@ -671,8 +669,8 @@ public class ObjectOutputStream extends OutputStream /** - @see java.io.DataOutputStream#write (byte[],int,int) - */ + * @see DataOutputStream#write(byte[],int,int) + */ public void write (byte[] b, int off, int len) throws IOException { if (writeDataAsBlocks) @@ -698,8 +696,8 @@ public class ObjectOutputStream extends OutputStream /** - @see java.io.DataOutputStream#flush () - */ + * @see DataOutputStream#flush() + */ public void flush () throws IOException { drain (); @@ -708,12 +706,12 @@ public class ObjectOutputStream extends OutputStream /** - Causes the block-data buffer to be written to the underlying - stream, but does not flush underlying stream. - - @exception IOException Exception from underlying - OutputStream. - */ + * Causes the block-data buffer to be written to the underlying + * stream, but does not flush underlying stream. + * + * @exception IOException Exception from underlying + * OutputStream. + */ protected void drain () throws IOException { if (blockDataCount == 0) @@ -727,8 +725,8 @@ public class ObjectOutputStream extends OutputStream /** - @see java.io.DataOutputStream#close () - */ + * @see java.io.DataOutputStream#close () + */ public void close () throws IOException { flush (); @@ -737,8 +735,8 @@ public class ObjectOutputStream extends OutputStream /** - @see java.io.DataOutputStream#writeBoolean (boolean) - */ + * @see java.io.DataOutputStream#writeBoolean (boolean) + */ public void writeBoolean (boolean data) throws IOException { blockDataOutput.writeBoolean (data); @@ -746,8 +744,8 @@ public class ObjectOutputStream extends OutputStream /** - @see java.io.DataOutputStream#writeByte (int) - */ + * @see java.io.DataOutputStream#writeByte (int) + */ public void writeByte (int data) throws IOException { blockDataOutput.writeByte (data); @@ -755,8 +753,8 @@ public class ObjectOutputStream extends OutputStream /** - @see java.io.DataOutputStream#writeShort (int) - */ + * @see java.io.DataOutputStream#writeShort (int) + */ public void writeShort (int data) throws IOException { blockDataOutput.writeShort (data); @@ -764,8 +762,8 @@ public class ObjectOutputStream extends OutputStream /** - @see java.io.DataOutputStream#writeChar (int) - */ + * @see java.io.DataOutputStream#writeChar (int) + */ public void writeChar (int data) throws IOException { blockDataOutput.writeChar (data); @@ -773,8 +771,8 @@ public class ObjectOutputStream extends OutputStream /** - @see java.io.DataOutputStream#writeInt (int) - */ + * @see java.io.DataOutputStream#writeInt (int) + */ public void writeInt (int data) throws IOException { blockDataOutput.writeInt (data); @@ -782,8 +780,8 @@ public class ObjectOutputStream extends OutputStream /** - @see java.io.DataOutputStream#writeLong (long) - */ + * @see java.io.DataOutputStream#writeLong (long) + */ public void writeLong (long data) throws IOException { blockDataOutput.writeLong (data); @@ -791,8 +789,8 @@ public class ObjectOutputStream extends OutputStream /** - @see java.io.DataOutputStream#writeFloat (float) - */ + * @see java.io.DataOutputStream#writeFloat (float) + */ public void writeFloat (float data) throws IOException { blockDataOutput.writeFloat (data); @@ -800,8 +798,8 @@ public class ObjectOutputStream extends OutputStream /** - @see java.io.DataOutputStream#writeDouble (double) - */ + * @see java.io.DataOutputStream#writeDouble (double) + */ public void writeDouble (double data) throws IOException { blockDataOutput.writeDouble (data); @@ -809,8 +807,8 @@ public class ObjectOutputStream extends OutputStream /** - @see java.io.DataOutputStream#writeBytes (java.lang.String) - */ + * @see java.io.DataOutputStream#writeBytes (java.lang.String) + */ public void writeBytes (String data) throws IOException { blockDataOutput.writeBytes (data); @@ -818,8 +816,8 @@ public class ObjectOutputStream extends OutputStream /** - @see java.io.DataOutputStream#writeChars (java.lang.String) - */ + * @see java.io.DataOutputStream#writeChars (java.lang.String) + */ public void writeChars (String data) throws IOException { dataOutput.writeChars (data); @@ -827,8 +825,8 @@ public class ObjectOutputStream extends OutputStream /** - @see java.io.DataOutputStream#writeUTF (java.lang.String) - */ + * @see java.io.DataOutputStream#writeUTF (java.lang.String) + */ public void writeUTF (String data) throws IOException { dataOutput.writeUTF (data); @@ -836,11 +834,11 @@ public class ObjectOutputStream extends OutputStream /** - This class allows a class to specify exactly which fields should - be written, and what values should be written for these fields. - - XXX: finish up comments - */ + * This class allows a class to specify exactly which fields should + * be written, and what values should be written for these fields. + * + * XXX: finish up comments + */ public static abstract class PutField { public abstract void put (String name, boolean value) @@ -864,7 +862,6 @@ public class ObjectOutputStream extends OutputStream public abstract void write (ObjectOutput out) throws IOException; } - public PutField putFields () throws IOException { markFieldsWritten (); diff --git a/libjava/java/io/OutputStreamWriter.java b/libjava/java/io/OutputStreamWriter.java index d551b5a..a284542 100644 --- a/libjava/java/io/OutputStreamWriter.java +++ b/libjava/java/io/OutputStreamWriter.java @@ -47,7 +47,6 @@ import gnu.gcj.convert.UnicodeToBytes; * API docs for JDK 1.2 beta from http://www.javasoft.com. * Status: Believed complete and correct, but only supports 8859_1. */ - public class OutputStreamWriter extends Writer { BufferedOutputStream out; diff --git a/libjava/java/io/Writer.java b/libjava/java/io/Writer.java index 3b2cf79..f3d6eaa 100644 --- a/libjava/java/io/Writer.java +++ b/libjava/java/io/Writer.java @@ -44,93 +44,75 @@ package java.io; */ /** - * This abstract class forms the base of the hierarchy of classes that - * write output as a stream of chars. It provides a common set of methods - * for writing chars to stream. Subclasses implement and/or extend these - * methods to write chars in a particular manner or to a particular - * destination such as a file on disk or network connection. - * - * @author Aaron M. Renn (arenn@urbanophile.com) - * @author Per Bothner - */ + * This abstract class forms the base of the hierarchy of classes that + * write output as a stream of chars. It provides a common set of methods + * for writing chars to stream. Subclasses implement and/or extend these + * methods to write chars in a particular manner or to a particular + * destination such as a file on disk or network connection. + * + * @author Aaron M. Renn (arenn@urbanophile.com) + * @author Per Bothner + */ 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 this - */ - protected Object lock; - - /*************************************************************************/ - - /* - * Constructors + * 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 this */ + protected Object lock; /** - * 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 + * will set up the class to synchronize criticial sections on itself. + */ protected Writer() { lock = this; } - /*************************************************************************/ - /** - * This method initializes a Writer that will synchronize - * on the specified Object. - * - * @param obj The Object to use for synchronizing critical - * sections - */ + * This method initializes a Writer that will synchronize + * on the specified Object. + * + * @param obj The Object to use for synchronizing critical + * sections + */ protected Writer(Object lock) { this.lock = lock; } - /*************************************************************************/ - - /* - * Instance Methods - */ - /** - * This method forces any data that may have been buffered to be written - * to the underlying output device. Please note that the host environment - * might perform its own buffering unbeknowst to Java. In that case, a - * write made (for example, to a disk drive) might be cached in OS - * buffers instead of actually being written to disk. - * - * @exception IOException If an error occurs - */ + * This method forces any data that may have been buffered to be written + * to the underlying output device. Please note that the host environment + * might perform its own buffering unbeknowst to Java. In that case, a + * write made (for example, to a disk drive) might be cached in OS + * buffers instead of actually being written to disk. + * + * @exception IOException If an error occurs + */ public abstract void flush() throws IOException; - /*************************************************************************/ - /** - * This method closes the stream. Any internal or native resources - * associated - * with this stream are freed. Any subsequent attempt to access the stream - * might throw an exception. - *

- * This method in this class does nothing. - * - * @exception IOException If an error occurs - */ + * This method closes the stream. Any internal or native resources + * associated + * with this stream are freed. Any subsequent attempt to access the stream + * might throw an exception. + *

+ * This method in this class does nothing. + * + * @exception IOException If an error occurs + */ public abstract void close() throws IOException; - /*************************************************************************/ - /** - * This method writes a single char to the output stream. - * - * @param b The char to be written to the output stream, passed as an int - * - * @exception IOException If an error occurs - */ + * This method writes a single char to the output stream. + * + * @param b The char to be written to the output stream, passed as an int + * + * @exception IOException If an error occurs + */ public void write(int b) throws IOException { char[] buf = new char[1]; @@ -139,68 +121,60 @@ public abstract class Writer write(buf, 0, buf.length); } - /*************************************************************************/ - /** - * This method all the writes char from the passed array to the output - * stream. This method is equivalent to - * write(buf, 0, buf.length) which - * is exactly how it is implemented in this class. - * - * @param buf The array of char to write - * - * @exception IOException If an error occurs - */ + * This method all the writes char from the passed array to the output + * stream. This method is equivalent to + * write(buf, 0, buf.length) which + * is exactly how it is implemented in this class. + * + * @param buf The array of char to write + * + * @exception IOException If an error occurs + */ public void write(char[] buf) throws IOException { write(buf, 0, buf.length); } - /*************************************************************************/ - /** - * This method writes len char from the specified array - * buf starting at index offset into the array. - *

- * Subclasses must provide an implementation of this abstract method. - * - * @param buf The array of char to write from - * @param offset The index into the array to start writing from - * @param len The number of char to write - * - * @exception IOException If an error occurs - */ + * This method writes len char from the specified array + * buf starting at index offset into the array. + *

+ * Subclasses must provide an implementation of this abstract method. + * + * @param buf The array of char to write from + * @param offset The index into the array to start writing from + * @param len The number of char to write + * + * @exception IOException If an error occurs + */ public abstract void write(char[] buf, int offset, int len) throws IOException; - /*************************************************************************/ - /** - * This method writes all the characters in a String to the - * output. - * - * @param str The String whose chars are to be written. - * - * @param IOException If an error occurs - */ + * This method writes all the characters in a String to the + * output. + * + * @param str The String whose chars are to be written. + * + * @param IOException If an error occurs + */ public void write(String str) throws IOException { write(str, 0, str.length()); } - /*************************************************************************/ - /** - * This method writes len chars from the String - * starting at position offset. - * - * @param str The String that is to be written - * @param offset The character offset into the String to start - * writing from - * @param len The number of chars to write - * - * @exception IOException If an error occurs - */ + * This method writes len chars from the String + * starting at position offset. + * + * @param str The String that is to be written + * @param offset The character offset into the String to start + * writing from + * @param len The number of chars to write + * + * @exception IOException If an error occurs + */ public void write(String str, int offset, int len) throws IOException { // FIXME - for libgcj re-write using native code to not require -- cgit v1.1