Commit ffe4ebba by Michael Koch Committed by Michael Koch

DataInputStream.java (): Wrapped documentation line.

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

	* 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
parent 228115ac
2003-03-24 Michael Koch <konqueror@gmx.de> 2003-03-24 Michael Koch <konqueror@gmx.de>
* 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.
2003-03-24 Michael Koch <konqueror@gmx.de>
* java/awt/Frame.java * java/awt/Frame.java
(DEFAULT_CURSOR): Fixed @deprecated tag. (DEFAULT_CURSOR): Fixed @deprecated tag.
(setCursor): Fixed @deprecated tag. (setCursor): Fixed @deprecated tag.
......
...@@ -596,7 +596,8 @@ public class DataInputStream extends FilterInputStream implements DataInput ...@@ -596,7 +596,8 @@ public class DataInputStream extends FilterInputStream implements DataInput
* character encoding, then they would be converted to a Java * character encoding, then they would be converted to a Java
* <code>char</code> like so: * <code>char</code> like so:
* <p> * <p>
* <code>(char)(((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) | (byte3 & 0x3F))</code> * <code>(char)(((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) |
* (byte3 & 0x3F))</code>
* <p> * <p>
* Note that all characters are encoded in the method that requires * Note that all characters are encoded in the method that requires
* the fewest number of bytes with the exception of the character * the fewest number of bytes with the exception of the character
...@@ -608,7 +609,7 @@ public class DataInputStream extends FilterInputStream implements DataInput ...@@ -608,7 +609,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
* This method can read data that was written by an object implementing the * This method can read data that was written by an object implementing the
* <code>writeUTF()</code> method in <code>DataOutput</code> * <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 * @exception EOFException If end of file is reached before reading
* the String * the String
......
...@@ -38,40 +38,90 @@ exception statement from your version. */ ...@@ -38,40 +38,90 @@ exception statement from your version. */
package java.io; package java.io;
/**
* @author Tom Tromey <tromey@cygnus.com>
* @date September 24, 1998
*/
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1 * "The Java Language Specification", ISBN 0-201-63451-1
* Status: Complete to version 1.1. * Status: Complete to version 1.1.
*/ */
/**
* This class provides a mechanism for writing primitive Java datatypes
* to an <code>OutputStream</code> in a portable way. Data written to
* a stream using this class can be read back in using the
* <code>DataInputStream</code> class on any platform.
*
* @see DataInputStream
*
* @author Aaron M. Renn <arenn@urbanophile.com>
* @author Tom Tromey <tromey@cygnus.com>
*/
public class DataOutputStream extends FilterOutputStream implements DataOutput 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 <code>DataOutputStream</code> to
* write its data to the specified underlying <code>OutputStream</code>
*
* @param out The subordinate <code>OutputStream</code> to which this
* object will write
*/
public DataOutputStream (OutputStream out) public DataOutputStream (OutputStream out)
{ {
super (out); super (out);
written = 0; written = 0;
} }
/**
* This method flushes any unwritten bytes to the underlying stream.
*
* @exception IOException If an error occurs.
*/
public void flush () throws IOException public void flush () throws IOException
{ {
out.flush(); 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
* <code>written</code> instance variable
*
* @return The number of bytes written to the stream.
*/
public final int size () public final int size ()
{ {
return written; return written;
} }
/**
* This method writes the specified byte (passed as an <code>int</code>)
* to the underlying output stream.
*
* @param b The byte to write, passed as an <code>int</code>.
*
* @exception IOException If an error occurs.
*/
public synchronized void write (int b) throws IOException public synchronized void write (int b) throws IOException
{ {
out.write(b); out.write(b);
++written; ++written;
} }
/**
* This method writes <code>len</code> bytes from the specified byte array
* <code>buf</code> starting at position <code>offset</code> 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) public synchronized void write (byte[] b, int off, int len)
throws IOException, NullPointerException, IndexOutOfBoundsException throws IOException, NullPointerException, IndexOutOfBoundsException
{ {
...@@ -79,28 +129,72 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput ...@@ -79,28 +129,72 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
written += len; written += len;
} }
/**
* This method writes a Java <code>boolean</code> to the underlying output
* stream. For a value of <code>true</code>, 1 is written to the stream.
* For a value of <code>false</code>, 0 is written.
*
* @param b The <code>boolean</code> value to write to the stream
*
* @exception IOException If an error occurs
*/
public final void writeBoolean (boolean v) throws IOException public final void writeBoolean (boolean v) throws IOException
{ {
write (v ? 1 : 0); write (v ? 1 : 0);
} }
/**
* This method writes a Java <code>byte</code> value to the underlying
* output stream.
*
* @param b The <code>byte</code> to write to the stream, passed as
* the low eight bits of an <code>int</code>.
*
* @exception IOException If an error occurs
*/
public final void writeByte (int v) throws IOException public final void writeByte (int v) throws IOException
{ {
write (v & 0xff); write (v & 0xff);
} }
/**
* This method writes a Java <code>short</code> to the stream, high byte
* first. This method requires two bytes to encode the value.
*
* @param s The <code>short</code> value to write to the stream,
* passed as an <code>int</code>.
*
* @exception IOException If an error occurs
*/
public final void writeShort (int v) throws IOException public final void writeShort (int v) throws IOException
{ {
write ((byte) (0xff & (v >> 8))); write ((byte) (0xff & (v >> 8)));
write ((byte) (0xff & v)); write ((byte) (0xff & v));
} }
/**
* This method writes a single <code>char</code> value to the stream,
* high byte first.
*
* @param c The <code>char</code> value to write,
* passed as an <code>int</code>.
*
* @exception IOException If an error occurs
*/
public final void writeChar (int v) throws IOException public final void writeChar (int v) throws IOException
{ {
write ((byte) (0xff & (v >> 8))); write ((byte) (0xff & (v >> 8)));
write ((byte) (0xff & v)); write ((byte) (0xff & v));
} }
/**
* This method writes a Java <code>int</code> to the stream, high bytes
* first. This method requires four bytes to encode the value.
*
* @param i The <code>int</code> value to write to the stream.
*
* @exception IOException If an error occurs
*/
public final void writeInt (int v) throws IOException public final void writeInt (int v) throws IOException
{ {
write ((byte) (0xff & (v >> 24))); write ((byte) (0xff & (v >> 24)));
...@@ -109,6 +203,14 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput ...@@ -109,6 +203,14 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
write ((byte) (0xff & v)); write ((byte) (0xff & v));
} }
/**
* This method writes a Java <code>long</code> to the stream, high bytes
* first. This method requires eight bytes to encode the value.
*
* @param l The <code>long</code> value to write to the stream.
*
* @exception IOException If an error occurs
*/
public final void writeLong (long v) throws IOException public final void writeLong (long v) throws IOException
{ {
write ((byte) (0xff & (v >> 56))); write ((byte) (0xff & (v >> 56)));
...@@ -121,16 +223,55 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput ...@@ -121,16 +223,55 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
write ((byte) (0xff & v)); write ((byte) (0xff & v));
} }
/**
* This method writes a Java <code>float</code> value to the stream. This
* value is written by first calling the method
* <code>Float.floatToIntBits</code>
* to retrieve an <code>int</code> representing the floating point number,
* then writing this <code>int</code> value to the stream exactly the same
* as the <code>writeInt()</code> 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 public final void writeFloat (float v) throws IOException
{ {
writeInt (Float.floatToIntBits(v)); writeInt (Float.floatToIntBits(v));
} }
/**
* This method writes a Java <code>double</code> value to the stream. This
* value is written by first calling the method
* <code>Double.doubleToLongBits</code>
* to retrieve an <code>long</code> representing the floating point number,
* then writing this <code>long</code> value to the stream exactly the same
* as the <code>writeLong()</code> 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 public final void writeDouble (double v) throws IOException
{ {
writeLong (Double.doubleToLongBits(v)); writeLong (Double.doubleToLongBits(v));
} }
/**
* This method writes all the bytes in a <code>String</code> out to the
* stream. One byte is written for each character in the
* <code>String</code>.
* The high eight bits of each character are discarded.
*
* @param s The <code>String</code> to write to the stream
*
* @exception IOException If an error occurs
*/
public final void writeBytes (String s) throws IOException public final void writeBytes (String s) throws IOException
{ {
int len = s.length(); int len = s.length();
...@@ -138,6 +279,15 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput ...@@ -138,6 +279,15 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
writeByte (s.charAt(i)); writeByte (s.charAt(i));
} }
/**
* This method writes all the characters in a <code>String</code> 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 <code>String</code> to write to the stream.
*
* @exception IOException If an error occurs
*/
public final void writeChars (String s) throws IOException public final void writeChars (String s) throws IOException
{ {
int len = s.length(); int len = s.length();
...@@ -145,6 +295,33 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput ...@@ -145,6 +295,33 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
writeChar (s.charAt(i)); writeChar (s.charAt(i));
} }
/**
* This method writes a Java <code>String</code> 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 <code>String</code> not the <code>String</code> length. Next
* come the encoded characters. Each character in the <code>String</code>
* is encoded as either one, two or three bytes. For characters in the
* range of <code>\u0001</code> 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 <code>\u0080</code> to <code>\u007FF</code>, 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
* <code>\u0000</code>. 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 <code>String</code> to write to the output in UTF format
*
* @exception IOException If an error occurs
*/
public final void writeUTF (String s) throws IOException public final void writeUTF (String s) throws IOException
{ {
int len = s.length(); int len = s.length();
...@@ -188,6 +365,5 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput ...@@ -188,6 +365,5 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
} }
} }
// Number of bytes written so far. } // class DataOutputStream
protected int written;
}
/* File.java -- Class representing a file on disk /* 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. This file is part of GNU Classpath.
......
...@@ -3,6 +3,11 @@ ...@@ -3,6 +3,11 @@
This file is part of GNU Classpath. 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 GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
...@@ -36,23 +41,43 @@ package java.io; ...@@ -36,23 +41,43 @@ package java.io;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import gnu.java.nio.FileChannelImpl; import gnu.java.nio.FileChannelImpl;
/**
* @author Warren Levy <warrenl@cygnus.com>
* @date October 28, 1998.
*/
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1 * "The Java Language Specification", ISBN 0-201-63451-1
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com. * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct. * Status: Believed complete and correct.
*/ */
/**
* This class is a stream that reads its bytes from a file.
*
* @author Aaron M. Renn <arenn@urbanophile.com>
* @author Warren Levy <warrenl@cygnus.com>
* @date October 28, 1998.
*/
public class FileInputStream extends InputStream 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 FileDescriptor fd;
private FileChannel ch; private FileChannel ch; /* cached associated file-channel */
/**
* This method initializes a <code>FileInputStream</code> 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 <code>checkRead()</code> method of the
* <code>SecurityManager</code>
* (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 public FileInputStream(String name) throws FileNotFoundException
{ {
SecurityManager s = System.getSecurityManager(); SecurityManager s = System.getSecurityManager();
...@@ -61,24 +86,83 @@ public class FileInputStream extends InputStream ...@@ -61,24 +86,83 @@ public class FileInputStream extends InputStream
fd = new FileDescriptor(name, FileDescriptor.READ); fd = new FileDescriptor(name, FileDescriptor.READ);
} }
/**
* This method initializes a <code>FileInputStream</code> to read from the
* specified <code>File</code> object. A security check is first
* made to determine
* whether or not access to this file is allowed. This is done by
* calling the <code>checkRead()</code> method of the
* <code>SecurityManager</code>
* (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 <code>File</code> 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 public FileInputStream(File file) throws FileNotFoundException
{ {
this(file.getPath()); this(file.getPath());
} }
/**
* This method initializes a <code>FileInputStream</code> to read from the
* specified <code>FileDescriptor</code> object. A security
* check is first made to
* determine whether or not access to this file is allowed. This is done by
* calling the <code>checkRead()</code> method of the
* <code>SecurityManager</code>
* (if one exists) with the specified <code>FileDescriptor</code>
* An exception is
* thrown if reading is not allowed.
*
* @param fd The <code>FileDescriptor</code> object this stream
* should read from
*
* @exception SecurityException If read access to the file is not allowed
*/
public FileInputStream(FileDescriptor fdObj) public FileInputStream(FileDescriptor fdObj)
{ {
SecurityManager s = System.getSecurityManager(); SecurityManager s = System.getSecurityManager();
if (s != null) if (s != null)
s.checkRead(fdObj); s.checkRead(fdObj);
fd = 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.
* <p>
* 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.
* <p>
* 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 public int available() throws IOException
{ {
return fd.available(); 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 public void close() throws IOException
{ {
if (fd.valid()) if (fd.valid())
...@@ -91,6 +175,15 @@ public class FileInputStream extends InputStream ...@@ -91,6 +175,15 @@ public class FileInputStream extends InputStream
// mentioned in the JCL. // mentioned in the JCL.
} }
/**
* This method returns a <code>FileDescriptor</code> object representing the
* underlying native file handle of the file this stream is reading
* from
*
* @return A <code>FileDescriptor</code> for this stream
*
* @exception IOException If an error occurs
*/
public final FileDescriptor getFD() throws IOException public final FileDescriptor getFD() throws IOException
{ {
if (!fd.valid()) if (!fd.valid())
...@@ -98,16 +191,63 @@ public class FileInputStream extends InputStream ...@@ -98,16 +191,63 @@ public class FileInputStream extends InputStream
return fd; 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.
* <p>
* 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 public int read() throws IOException
{ {
return fd.read(); 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.
* <p>
* This method will block until some data can be read.
* <p>
* This method operates by calling an overloaded read method like so:
* <code>read(buf, 0, buf.length)</code>
*
* @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 public int read(byte[] b) throws IOException
{ {
return fd.read(b, 0, b.length); 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
* <code>offset</code> into
* the buffer and attempts to read <code>len</code> 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.
* <p>
* 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 public int read(byte[] b, int off, int len) throws IOException
{ {
if (off < 0 || len < 0 || off + len > b.length) if (off < 0 || len < 0 || off + len > b.length)
...@@ -116,6 +256,17 @@ public class FileInputStream extends InputStream ...@@ -116,6 +256,17 @@ public class FileInputStream extends InputStream
return fd.read(b, off, len); 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.
* <p>
* @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 public long skip(long n) throws IOException
{ {
long startPos = fd.getFilePointer(); long startPos = fd.getFilePointer();
...@@ -123,6 +274,12 @@ public class FileInputStream extends InputStream ...@@ -123,6 +274,12 @@ public class FileInputStream extends InputStream
return endPos - startPos; 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 () public FileChannel getChannel ()
{ {
synchronized (this) synchronized (this)
...@@ -133,4 +290,6 @@ public class FileInputStream extends InputStream ...@@ -133,4 +290,6 @@ public class FileInputStream extends InputStream
return ch; return ch;
} }
} }
}
} // class FileInputStream
...@@ -100,7 +100,7 @@ public class LineNumberReader extends BufferedReader ...@@ -100,7 +100,7 @@ public class LineNumberReader extends BufferedReader
/** /**
* This method returns the current line number * This method returns the current line number
* *
* @returns The current line number * @return The current line number
*/ */
public int getLineNumber() public int getLineNumber()
{ {
......
...@@ -57,18 +57,18 @@ public class ObjectInputStream extends InputStream ...@@ -57,18 +57,18 @@ public class ObjectInputStream extends InputStream
implements ObjectInput, ObjectStreamConstants implements ObjectInput, ObjectStreamConstants
{ {
/** /**
Creates a new <code>ObjectInputStream</code> that will do all of * Creates a new <code>ObjectInputStream</code> that will do all of
its reading from <code>in</code>. This method also checks * its reading from <code>in</code>. This method also checks
the stream by reading the header information (stream magic number * the stream by reading the header information (stream magic number
and stream version). * and stream version).
*
@exception IOException Reading stream header from underlying * @exception IOException Reading stream header from underlying
stream cannot be completed. * stream cannot be completed.
*
@exception StreamCorruptedException An invalid stream magic * @exception StreamCorruptedException An invalid stream magic
number or stream version was read from the stream. * number or stream version was read from the stream.
*
@see readStreamHeader () * @see #readStreamHeader()
*/ */
public ObjectInputStream (InputStream in) public ObjectInputStream (InputStream in)
throws IOException, StreamCorruptedException throws IOException, StreamCorruptedException
...@@ -104,19 +104,19 @@ public class ObjectInputStream extends InputStream ...@@ -104,19 +104,19 @@ public class ObjectInputStream extends InputStream
/** /**
Returns the next deserialized object read from the underlying stream. * Returns the next deserialized object read from the underlying stream.
*
This method can be overriden by a class by implementing * This method can be overriden by a class by implementing
<code>private void readObject (ObjectInputStream)</code>. * <code>private void readObject (ObjectInputStream)</code>.
*
If an exception is thrown from this method, the stream is left in * If an exception is thrown from this method, the stream is left in
an undefined state. * an undefined state.
*
@exception ClassNotFoundException The class that an object being * @exception ClassNotFoundException The class that an object being
read in belongs to cannot be found. * read in belongs to cannot be found.
*
@exception IOException Exception from underlying * @exception IOException Exception from underlying
<code>InputStream</code>. * <code>InputStream</code>.
*/ */
public final Object readObject () throws ClassNotFoundException, IOException public final Object readObject () throws ClassNotFoundException, IOException
{ {
...@@ -452,23 +452,23 @@ public class ObjectInputStream extends InputStream ...@@ -452,23 +452,23 @@ public class ObjectInputStream extends InputStream
} }
/** /**
Reads the current objects non-transient, non-static fields from * Reads the current objects non-transient, non-static fields from
the current class from the underlying output stream. * the current class from the underlying output stream.
*
This method is intended to be called from within a object's * This method is intended to be called from within a object's
<code>private void readObject (ObjectInputStream)</code> * <code>private void readObject (ObjectInputStream)</code>
method. * method.
*
@exception ClassNotFoundException The class that an object being * @exception ClassNotFoundException The class that an object being
read in belongs to cannot be found. * read in belongs to cannot be found.
*
@exception NotActiveException This method was called from a * @exception NotActiveException This method was called from a
context other than from the current object's and current class's * context other than from the current object's and current class's
<code>private void readObject (ObjectInputStream)</code> * <code>private void readObject (ObjectInputStream)</code>
method. * method.
*
@exception IOException Exception from underlying * @exception IOException Exception from underlying
<code>OutputStream</code>. * <code>OutputStream</code>.
*/ */
public void defaultReadObject () public void defaultReadObject ()
throws ClassNotFoundException, IOException, NotActiveException throws ClassNotFoundException, IOException, NotActiveException
...@@ -488,22 +488,22 @@ public class ObjectInputStream extends InputStream ...@@ -488,22 +488,22 @@ public class ObjectInputStream extends InputStream
/** /**
Registers a <code>ObjectInputValidation</code> to be carried out * Registers a <code>ObjectInputValidation</code> to be carried out
on the object graph currently being deserialized before it is * on the object graph currently being deserialized before it is
returned to the original caller of <code>readObject ()</code>. * returned to the original caller of <code>readObject ()</code>.
The order of validation for multiple * The order of validation for multiple
<code>ObjectInputValidation</code>s can be controled using * <code>ObjectInputValidation</code>s can be controled using
<code>priority</code>. Validators with higher priorities are * <code>priority</code>. Validators with higher priorities are
called first. * called first.
*
@see java.io.ObjectInputValidation * @see java.io.ObjectInputValidation
*
@exception InvalidObjectException <code>validator</code> is * @exception InvalidObjectException <code>validator</code> is
<code>null</code> * <code>null</code>
*
@exception NotActiveException an attempt was made to add a * @exception NotActiveException an attempt was made to add a
validator outside of the <code>readObject</code> method of the * validator outside of the <code>readObject</code> method of the
object currently being deserialized * object currently being deserialized
*/ */
public void registerValidation (ObjectInputValidation validator, public void registerValidation (ObjectInputValidation validator,
int priority) int priority)
...@@ -521,20 +521,20 @@ public class ObjectInputStream extends InputStream ...@@ -521,20 +521,20 @@ public class ObjectInputStream extends InputStream
/** /**
Called when a class is being deserialized. This is a hook to * Called when a class is being deserialized. This is a hook to
allow subclasses to read in information written by the * allow subclasses to read in information written by the
<code>annotateClass (Class)</code> method of an * <code>annotateClass (Class)</code> method of an
<code>ObjectOutputStream</code>. * <code>ObjectOutputStream</code>.
*
This implementation looks up the active call stack for a * This implementation looks up the active call stack for a
<code>ClassLoader</code>; if a <code>ClassLoader</code> is found, * <code>ClassLoader</code>; if a <code>ClassLoader</code> is found,
it is used to load the class associated with <code>osc</code>, * it is used to load the class associated with <code>osc</code>,
otherwise, the default system <code>ClassLoader</code> is used. * otherwise, the default system <code>ClassLoader</code> is used.
*
@exception IOException Exception from underlying * @exception IOException Exception from underlying
<code>OutputStream</code>. * <code>OutputStream</code>.
*
@see java.io.ObjectOutputStream#annotateClass (java.lang.Class) * @see java.io.ObjectOutputStream#annotateClass (java.lang.Class)
*/ */
protected Class resolveClass (ObjectStreamClass osc) protected Class resolveClass (ObjectStreamClass osc)
throws ClassNotFoundException, IOException throws ClassNotFoundException, IOException
...@@ -555,17 +555,17 @@ public class ObjectInputStream extends InputStream ...@@ -555,17 +555,17 @@ public class ObjectInputStream extends InputStream
} }
/** /**
Allows subclasses to resolve objects that are read from the * Allows subclasses to resolve objects that are read from the
stream with other objects to be returned in their place. This * stream with other objects to be returned in their place. This
method is called the first time each object is encountered. * method is called the first time each object is encountered.
*
This method must be enabled before it will be called in the * This method must be enabled before it will be called in the
serialization process. * serialization process.
*
@exception IOException Exception from underlying * @exception IOException Exception from underlying
<code>OutputStream</code>. * <code>OutputStream</code>.
*
@see enableResolveObject (boolean) * @see #enableResolveObject(boolean)
*/ */
protected Object resolveObject (Object obj) throws IOException protected Object resolveObject (Object obj) throws IOException
{ {
...@@ -600,12 +600,12 @@ public class ObjectInputStream extends InputStream ...@@ -600,12 +600,12 @@ public class ObjectInputStream extends InputStream
} }
/** /**
If <code>enable</code> is <code>true</code> and this object is * If <code>enable</code> is <code>true</code> and this object is
trusted, then <code>resolveObject (Object)</code> will be called * trusted, then <code>resolveObject (Object)</code> will be called
in subsequent calls to <code>readObject (Object)</code>. * in subsequent calls to <code>readObject (Object)</code>.
Otherwise, <code>resolveObject (Object)</code> will not be called. * Otherwise, <code>resolveObject (Object)</code> will not be called.
*
@exception SecurityException This class is not trusted. * @exception SecurityException This class is not trusted.
*/ */
protected boolean enableResolveObject (boolean enable) protected boolean enableResolveObject (boolean enable)
throws SecurityException throws SecurityException
...@@ -622,15 +622,14 @@ public class ObjectInputStream extends InputStream ...@@ -622,15 +622,14 @@ public class ObjectInputStream extends InputStream
return old_val; return old_val;
} }
/** /**
Reads stream magic and stream version information from the * Reads stream magic and stream version information from the
underlying stream. * underlying stream.
*
@exception IOException Exception from underlying stream. * @exception IOException Exception from underlying stream.
*
@exception StreamCorruptedException An invalid stream magic * @exception StreamCorruptedException An invalid stream magic
number or stream version was read from the stream. * number or stream version was read from the stream.
*/ */
protected void readStreamHeader () protected void readStreamHeader ()
throws IOException, StreamCorruptedException throws IOException, StreamCorruptedException
...@@ -644,7 +643,6 @@ public class ObjectInputStream extends InputStream ...@@ -644,7 +643,6 @@ public class ObjectInputStream extends InputStream
throw new StreamCorruptedException ("Invalid stream version number"); throw new StreamCorruptedException ("Invalid stream version number");
} }
public int read () throws IOException public int read () throws IOException
{ {
if (this.readDataFromBlock) if (this.readDataFromBlock)
...@@ -769,8 +767,8 @@ public class ObjectInputStream extends InputStream ...@@ -769,8 +767,8 @@ public class ObjectInputStream extends InputStream
} }
/** /**
@deprecated * @deprecated
@see java.io.DataInputStream#readLine () * @see java.io.DataInputStream#readLine ()
*/ */
public String readLine () throws IOException public String readLine () throws IOException
{ {
...@@ -782,12 +780,11 @@ public class ObjectInputStream extends InputStream ...@@ -782,12 +780,11 @@ public class ObjectInputStream extends InputStream
return this.dataInputStream.readUTF (); return this.dataInputStream.readUTF ();
} }
/** /**
This class allows a class to specify exactly which fields should * This class allows a class to specify exactly which fields should
be read, and what values should be read for these fields. * be read, and what values should be read for these fields.
*
XXX: finish up comments * XXX: finish up comments
*/ */
public static abstract class GetField public static abstract class GetField
{ {
...@@ -1018,17 +1015,16 @@ public class ObjectInputStream extends InputStream ...@@ -1018,17 +1015,16 @@ public class ObjectInputStream extends InputStream
} }
/** /**
Protected constructor that allows subclasses to override * Protected constructor that allows subclasses to override
deserialization. This constructor should be called by subclasses * deserialization. This constructor should be called by subclasses
that wish to override <code>readObject (Object)</code>. This * that wish to override <code>readObject (Object)</code>. This
method does a security check <i>NOTE: currently not * method does a security check <i>NOTE: currently not
implemented</i>, then sets a flag that informs * implemented</i>, then sets a flag that informs
<code>readObject (Object)</code> to call the subclasses * <code>readObject (Object)</code> to call the subclasses
<code>readObjectOverride (Object)</code> method. * <code>readObjectOverride (Object)</code> method.
*
@see readObjectOverride (Object) * @see #readObjectOverride()
*/ */
protected ObjectInputStream () protected ObjectInputStream ()
throws IOException, SecurityException throws IOException, SecurityException
...@@ -1039,15 +1035,14 @@ public class ObjectInputStream extends InputStream ...@@ -1039,15 +1035,14 @@ public class ObjectInputStream extends InputStream
this.useSubclassMethod = true; this.useSubclassMethod = true;
} }
/** /**
This method allows subclasses to override the default * This method allows subclasses to override the default
de serialization mechanism provided by * de serialization mechanism provided by
<code>ObjectInputStream</code>. To make this method be used for * <code>ObjectInputStream</code>. To make this method be used for
writing objects, subclasses must invoke the 0-argument * writing objects, subclasses must invoke the 0-argument
constructor on this class from their constructor. * constructor on this class from their constructor.
*
@see ObjectInputStream () * @see #ObjectInputStream()
*/ */
protected Object readObjectOverride () protected Object readObjectOverride ()
throws ClassNotFoundException, IOException, OptionalDataException throws ClassNotFoundException, IOException, OptionalDataException
...@@ -1055,7 +1050,6 @@ public class ObjectInputStream extends InputStream ...@@ -1055,7 +1050,6 @@ public class ObjectInputStream extends InputStream
throw new IOException ("Subclass of ObjectInputStream must implement readObjectOverride"); throw new IOException ("Subclass of ObjectInputStream must implement readObjectOverride");
} }
// assigns the next availible handle to OBJ // assigns the next availible handle to OBJ
private int assignNewHandle (Object obj) private int assignNewHandle (Object obj)
{ {
...@@ -1064,7 +1058,6 @@ public class ObjectInputStream extends InputStream ...@@ -1064,7 +1058,6 @@ public class ObjectInputStream extends InputStream
return this.nextOID++; return this.nextOID++;
} }
private Object processResolution (Object obj, int handle) private Object processResolution (Object obj, int handle)
throws IOException throws IOException
{ {
...@@ -1099,20 +1092,17 @@ public class ObjectInputStream extends InputStream ...@@ -1099,20 +1092,17 @@ public class ObjectInputStream extends InputStream
return obj; return obj;
} }
private void clearHandles () private void clearHandles ()
{ {
this.objectLookupTable.clear (); this.objectLookupTable.clear ();
this.nextOID = baseWireHandle; this.nextOID = baseWireHandle;
} }
private void readNextBlock () throws IOException private void readNextBlock () throws IOException
{ {
readNextBlock (this.realInputStream.readByte ()); readNextBlock (this.realInputStream.readByte ());
} }
private void readNextBlock (byte marker) throws IOException private void readNextBlock (byte marker) throws IOException
{ {
if (marker == TC_BLOCKDATA) if (marker == TC_BLOCKDATA)
...@@ -1139,7 +1129,6 @@ public class ObjectInputStream extends InputStream ...@@ -1139,7 +1129,6 @@ public class ObjectInputStream extends InputStream
this.blockDataPosition = 0; this.blockDataPosition = 0;
} }
private void readArrayElements (Object array, Class clazz) private void readArrayElements (Object array, Class clazz)
throws ClassNotFoundException, IOException throws ClassNotFoundException, IOException
{ {
...@@ -1210,7 +1199,6 @@ public class ObjectInputStream extends InputStream ...@@ -1210,7 +1199,6 @@ public class ObjectInputStream extends InputStream
} }
} }
private void readFields (Object obj, ObjectStreamClass stream_osc) private void readFields (Object obj, ObjectStreamClass stream_osc)
throws ClassNotFoundException, IOException throws ClassNotFoundException, IOException
{ {
...@@ -1374,7 +1362,6 @@ public class ObjectInputStream extends InputStream ...@@ -1374,7 +1362,6 @@ public class ObjectInputStream extends InputStream
return oldmode; return oldmode;
} }
// returns a new instance of REAL_CLASS that has been constructed // returns a new instance of REAL_CLASS that has been constructed
// only to the level of CONSTRUCTOR_CLASS (a super class of REAL_CLASS) // only to the level of CONSTRUCTOR_CLASS (a super class of REAL_CLASS)
private Object newObject (Class real_class, Class constructor_class) private Object newObject (Class real_class, Class constructor_class)
...@@ -1391,7 +1378,6 @@ public class ObjectInputStream extends InputStream ...@@ -1391,7 +1378,6 @@ public class ObjectInputStream extends InputStream
} }
} }
// runs all registered ObjectInputValidations in prioritized order // runs all registered ObjectInputValidations in prioritized order
// on OBJ // on OBJ
private void invokeValidators () throws InvalidObjectException private void invokeValidators () throws InvalidObjectException
...@@ -1411,7 +1397,6 @@ public class ObjectInputStream extends InputStream ...@@ -1411,7 +1397,6 @@ public class ObjectInputStream extends InputStream
} }
} }
// this native method is used to get access to the protected method // this native method is used to get access to the protected method
// of the same name in SecurityManger // of the same name in SecurityManger
private static ClassLoader currentClassLoader (SecurityManager sm) private static ClassLoader currentClassLoader (SecurityManager sm)
......
...@@ -49,85 +49,84 @@ import gnu.java.lang.reflect.TypeSignature; ...@@ -49,85 +49,84 @@ import gnu.java.lang.reflect.TypeSignature;
import gnu.classpath.Configuration; import gnu.classpath.Configuration;
/** /**
An <code>ObjectOutputStream</code> can be used to write objects * An <code>ObjectOutputStream</code> can be used to write objects
as well as primitive data in a platform-independent manner to an * as well as primitive data in a platform-independent manner to an
<code>OutputStream</code>. * <code>OutputStream</code>.
*
The data produced by an <code>ObjectOutputStream</code> can be read * The data produced by an <code>ObjectOutputStream</code> can be read
and reconstituted by an <code>ObjectInputStream</code>. * and reconstituted by an <code>ObjectInputStream</code>.
*
<code>writeObject (Object)</code> is used to write Objects, the * <code>writeObject (Object)</code> is used to write Objects, the
<code>write&lt;type&gt;</code> methods are used to write primitive * <code>write&lt;type&gt;</code> methods are used to write primitive
data (as in <code>DataOutputStream</code>). Strings can be written * data (as in <code>DataOutputStream</code>). Strings can be written
as objects or as primitive data. * as objects or as primitive data.
*
Not all objects can be written out using an * Not all objects can be written out using an
<code>ObjectOutputStream</code>. Only those objects that are an * <code>ObjectOutputStream</code>. Only those objects that are an
instance of <code>java.io.Serializable</code> can be written. * instance of <code>java.io.Serializable</code> can be written.
*
Using default serialization, information about the class of an * Using default serialization, information about the class of an
object is written, all of the non-transient, non-static fields of * 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 * the object are written, if any of these fields are objects, they are
written out in the same manner. * written out in the same manner.
*
An object is only written out the first time it is encountered. If * 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 object is encountered later, a reference to it is written to
the underlying stream. Thus writing circular object graphs * the underlying stream. Thus writing circular object graphs
does not present a problem, nor are relationships between objects * does not present a problem, nor are relationships between objects
in a graph lost. * in a graph lost.
*
Example usage: * Example usage:
<pre> * <pre>
Hashtable map = new Hashtable (); * Hashtable map = new Hashtable ();
map.put ("one", new Integer (1)); * map.put ("one", new Integer (1));
map.put ("two", new Integer (2)); * map.put ("two", new Integer (2));
*
ObjectOutputStream oos = * ObjectOutputStream oos =
new ObjectOutputStream (new FileOutputStream ("numbers")); * new ObjectOutputStream (new FileOutputStream ("numbers"));
oos.writeObject (map); * oos.writeObject (map);
oos.close (); * oos.close ();
*
ObjectInputStream ois = * ObjectInputStream ois =
new ObjectInputStream (new FileInputStream ("numbers")); * new ObjectInputStream (new FileInputStream ("numbers"));
Hashtable newmap = (Hashtable)ois.readObject (); * Hashtable newmap = (Hashtable)ois.readObject ();
*
System.out.println (newmap); * System.out.println (newmap);
</pre> * </pre>
*
The default serialization can be overriden in two ways. * The default serialization can be overriden in two ways.
*
By defining a method <code>private void * By defining a method <code>private void
writeObject (ObjectOutputStream)</code>, a class can dictate exactly * writeObject (ObjectOutputStream)</code>, a class can dictate exactly
how information about itself is written. * how information about itself is written.
<code>defaultWriteObject ()</code> may be called from this method to * <code>defaultWriteObject ()</code> may be called from this method to
carry out default serialization. This method is not * carry out default serialization. This method is not
responsible for dealing with fields of super-classes or subclasses. * responsible for dealing with fields of super-classes or subclasses.
*
By implementing <code>java.io.Externalizable</code>. This gives * By implementing <code>java.io.Externalizable</code>. This gives
the class complete control over the way it is written to the * the class complete control over the way it is written to the
stream. If this approach is used the burden of writing superclass * stream. If this approach is used the burden of writing superclass
and subclass data is transfered to the class implementing * and subclass data is transfered to the class implementing
<code>java.io.Externalizable</code>. * <code>java.io.Externalizable</code>.
*
@see java.io.DataOutputStream * @see java.io.DataOutputStream
@see java.io.Externalizable * @see java.io.Externalizable
@see java.io.ObjectInputStream * @see java.io.ObjectInputStream
@see java.io.Serializable * @see java.io.Serializable
@see XXX: java serialization spec */
*/
public class ObjectOutputStream extends OutputStream public class ObjectOutputStream extends OutputStream
implements ObjectOutput, ObjectStreamConstants implements ObjectOutput, ObjectStreamConstants
{ {
/** /**
Creates a new <code>ObjectOutputStream</code> that will do all of * Creates a new <code>ObjectOutputStream</code> that will do all of
its writing onto <code>out</code>. This method also initializes * its writing onto <code>out</code>. This method also initializes
the stream by writing the header information (stream magic number * the stream by writing the header information (stream magic number
and stream version). * and stream version).
*
@exception IOException Writing stream header to underlying * @exception IOException Writing stream header to underlying
stream cannot be completed. * stream cannot be completed.
*
@see writeStreamHeader () * @see #writeStreamHeader()
*/ */
public ObjectOutputStream (OutputStream out) throws IOException public ObjectOutputStream (OutputStream out) throws IOException
{ {
...@@ -145,25 +144,24 @@ public class ObjectOutputStream extends OutputStream ...@@ -145,25 +144,24 @@ public class ObjectOutputStream extends OutputStream
writeStreamHeader (); writeStreamHeader ();
} }
/** /**
Writes a representation of <code>obj</code> to the underlying * Writes a representation of <code>obj</code> to the underlying
output stream by writing out information about its class, then * output stream by writing out information about its class, then
writing out each of the objects non-transient, non-static * writing out each of the objects non-transient, non-static
fields. If any of these fields are other objects, * fields. If any of these fields are other objects,
they are written out in the same manner. * they are written out in the same manner.
*
This method can be overriden by a class by implementing * This method can be overriden by a class by implementing
<code>private void writeObject (ObjectOutputStream)</code>. * <code>private void writeObject (ObjectOutputStream)</code>.
*
If an exception is thrown from this method, the stream is left in * If an exception is thrown from this method, the stream is left in
an undefined state. * an undefined state.
*
@exception NotSerializableException An attempt was made to * @exception NotSerializableException An attempt was made to
serialize an <code>Object</code> that is not serializable. * serialize an <code>Object</code> that is not serializable.
*
@exception IOException Exception from underlying * @exception IOException Exception from underlying
<code>OutputStream</code>. * <code>OutputStream</code>.
*/ */
public final void writeObject (Object obj) throws IOException public final void writeObject (Object obj) throws IOException
{ {
...@@ -494,7 +492,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -494,7 +492,7 @@ public class ObjectOutputStream extends OutputStream
@exception IOException if <code>version</code> is not a valid @exception IOException if <code>version</code> is not a valid
protocol protocol
@see setDefaultProtocolVersion (int) @see #setDefaultProtocolVersion(int)
*/ */
public void useProtocolVersion (int version) throws IOException public void useProtocolVersion (int version) throws IOException
{ {
...@@ -517,7 +515,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -517,7 +515,7 @@ public class ObjectOutputStream extends OutputStream
@exception IOException if <code>version</code> is not a valid @exception IOException if <code>version</code> is not a valid
protocol protocol
@see useProtocolVersion (int) @see #useProtocolVersion(int)
*/ */
public static void setDefaultProtocolVersion (int version) public static void setDefaultProtocolVersion (int version)
throws IOException throws IOException
...@@ -538,7 +536,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -538,7 +536,7 @@ public class ObjectOutputStream extends OutputStream
@exception IOException Exception from underlying @exception IOException Exception from underlying
<code>OutputStream</code>. <code>OutputStream</code>.
@see java.io.ObjectInputStream#resolveClass (java.io.ObjectStreamClass) @see ObjectInputStream#resolveClass(java.io.ObjectStreamClass)
*/ */
protected void annotateClass (Class cl) throws IOException protected void annotateClass (Class cl) throws IOException
{} {}
...@@ -558,7 +556,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -558,7 +556,7 @@ public class ObjectOutputStream extends OutputStream
@exception IOException Exception from underlying @exception IOException Exception from underlying
<code>OutputStream</code>. <code>OutputStream</code>.
@see enableReplaceObject (boolean) @see #enableReplaceObject(boolean)
*/ */
protected Object replaceObject (Object obj) throws IOException protected Object replaceObject (Object obj) throws IOException
{ {
...@@ -606,15 +604,15 @@ public class ObjectOutputStream extends OutputStream ...@@ -606,15 +604,15 @@ public class ObjectOutputStream extends OutputStream
/** /**
Protected constructor that allows subclasses to override * Protected constructor that allows subclasses to override
serialization. This constructor should be called by subclasses * serialization. This constructor should be called by subclasses
that wish to override <code>writeObject (Object)</code>. This * that wish to override <code>writeObject (Object)</code>. This
method does a security check <i>NOTE: currently not * method does a security check <i>NOTE: currently not
implemented</i>, then sets a flag that informs * implemented</i>, then sets a flag that informs
<code>writeObject (Object)</code> to call the subclasses * <code>writeObject (Object)</code> to call the subclasses
<code>writeObjectOverride (Object)</code> method. * <code>writeObjectOverride (Object)</code> method.
*
@see writeObjectOverride (Object) * @see #writeObjectOverride(Object)
*/ */
protected ObjectOutputStream () throws IOException, SecurityException protected ObjectOutputStream () throws IOException, SecurityException
{ {
...@@ -626,16 +624,16 @@ public class ObjectOutputStream extends OutputStream ...@@ -626,16 +624,16 @@ public class ObjectOutputStream extends OutputStream
/** /**
This method allows subclasses to override the default * This method allows subclasses to override the default
serialization mechanism provided by * serialization mechanism provided by
<code>ObjectOutputStream</code>. To make this method be used for * <code>ObjectOutputStream</code>. To make this method be used for
writing objects, subclasses must invoke the 0-argument * writing objects, subclasses must invoke the 0-argument
constructor on this class from there constructor. * constructor on this class from there constructor.
*
@see ObjectOutputStream () * @see #ObjectOutputStream()
*
@exception NotActiveException Subclass has arranged for this * @exception NotActiveException Subclass has arranged for this
method to be called, but did not implement this method. * method to be called, but did not implement this method.
*/ */
protected void writeObjectOverride (Object obj) throws NotActiveException, protected void writeObjectOverride (Object obj) throws NotActiveException,
IOException IOException
...@@ -645,7 +643,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -645,7 +643,7 @@ public class ObjectOutputStream extends OutputStream
/** /**
@see java.io.DataOutputStream#write (int) * @see DataOutputStream#write(int)
*/ */
public void write (int data) throws IOException public void write (int data) throws IOException
{ {
...@@ -662,7 +660,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -662,7 +660,7 @@ public class ObjectOutputStream extends OutputStream
/** /**
@see java.io.DataOutputStream#write (byte[]) * @see DataOutputStream#write(byte[])
*/ */
public void write (byte[] b) throws IOException public void write (byte[] b) throws IOException
{ {
...@@ -671,7 +669,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -671,7 +669,7 @@ 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 public void write (byte[] b, int off, int len) throws IOException
{ {
...@@ -698,7 +696,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -698,7 +696,7 @@ public class ObjectOutputStream extends OutputStream
/** /**
@see java.io.DataOutputStream#flush () * @see DataOutputStream#flush()
*/ */
public void flush () throws IOException public void flush () throws IOException
{ {
...@@ -708,11 +706,11 @@ public class ObjectOutputStream extends OutputStream ...@@ -708,11 +706,11 @@ public class ObjectOutputStream extends OutputStream
/** /**
Causes the block-data buffer to be written to the underlying * Causes the block-data buffer to be written to the underlying
stream, but does not flush underlying stream. * stream, but does not flush underlying stream.
*
@exception IOException Exception from underlying * @exception IOException Exception from underlying
<code>OutputStream</code>. * <code>OutputStream</code>.
*/ */
protected void drain () throws IOException protected void drain () throws IOException
{ {
...@@ -727,7 +725,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -727,7 +725,7 @@ public class ObjectOutputStream extends OutputStream
/** /**
@see java.io.DataOutputStream#close () * @see java.io.DataOutputStream#close ()
*/ */
public void close () throws IOException public void close () throws IOException
{ {
...@@ -737,7 +735,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -737,7 +735,7 @@ public class ObjectOutputStream extends OutputStream
/** /**
@see java.io.DataOutputStream#writeBoolean (boolean) * @see java.io.DataOutputStream#writeBoolean (boolean)
*/ */
public void writeBoolean (boolean data) throws IOException public void writeBoolean (boolean data) throws IOException
{ {
...@@ -746,7 +744,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -746,7 +744,7 @@ public class ObjectOutputStream extends OutputStream
/** /**
@see java.io.DataOutputStream#writeByte (int) * @see java.io.DataOutputStream#writeByte (int)
*/ */
public void writeByte (int data) throws IOException public void writeByte (int data) throws IOException
{ {
...@@ -755,7 +753,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -755,7 +753,7 @@ public class ObjectOutputStream extends OutputStream
/** /**
@see java.io.DataOutputStream#writeShort (int) * @see java.io.DataOutputStream#writeShort (int)
*/ */
public void writeShort (int data) throws IOException public void writeShort (int data) throws IOException
{ {
...@@ -764,7 +762,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -764,7 +762,7 @@ public class ObjectOutputStream extends OutputStream
/** /**
@see java.io.DataOutputStream#writeChar (int) * @see java.io.DataOutputStream#writeChar (int)
*/ */
public void writeChar (int data) throws IOException public void writeChar (int data) throws IOException
{ {
...@@ -773,7 +771,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -773,7 +771,7 @@ public class ObjectOutputStream extends OutputStream
/** /**
@see java.io.DataOutputStream#writeInt (int) * @see java.io.DataOutputStream#writeInt (int)
*/ */
public void writeInt (int data) throws IOException public void writeInt (int data) throws IOException
{ {
...@@ -782,7 +780,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -782,7 +780,7 @@ public class ObjectOutputStream extends OutputStream
/** /**
@see java.io.DataOutputStream#writeLong (long) * @see java.io.DataOutputStream#writeLong (long)
*/ */
public void writeLong (long data) throws IOException public void writeLong (long data) throws IOException
{ {
...@@ -791,7 +789,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -791,7 +789,7 @@ public class ObjectOutputStream extends OutputStream
/** /**
@see java.io.DataOutputStream#writeFloat (float) * @see java.io.DataOutputStream#writeFloat (float)
*/ */
public void writeFloat (float data) throws IOException public void writeFloat (float data) throws IOException
{ {
...@@ -800,7 +798,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -800,7 +798,7 @@ public class ObjectOutputStream extends OutputStream
/** /**
@see java.io.DataOutputStream#writeDouble (double) * @see java.io.DataOutputStream#writeDouble (double)
*/ */
public void writeDouble (double data) throws IOException public void writeDouble (double data) throws IOException
{ {
...@@ -809,7 +807,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -809,7 +807,7 @@ 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 public void writeBytes (String data) throws IOException
{ {
...@@ -818,7 +816,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -818,7 +816,7 @@ 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 public void writeChars (String data) throws IOException
{ {
...@@ -827,7 +825,7 @@ public class ObjectOutputStream extends OutputStream ...@@ -827,7 +825,7 @@ 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 public void writeUTF (String data) throws IOException
{ {
...@@ -836,10 +834,10 @@ public class ObjectOutputStream extends OutputStream ...@@ -836,10 +834,10 @@ public class ObjectOutputStream extends OutputStream
/** /**
This class allows a class to specify exactly which fields should * This class allows a class to specify exactly which fields should
be written, and what values should be written for these fields. * be written, and what values should be written for these fields.
*
XXX: finish up comments * XXX: finish up comments
*/ */
public static abstract class PutField public static abstract class PutField
{ {
...@@ -864,7 +862,6 @@ public class ObjectOutputStream extends OutputStream ...@@ -864,7 +862,6 @@ public class ObjectOutputStream extends OutputStream
public abstract void write (ObjectOutput out) throws IOException; public abstract void write (ObjectOutput out) throws IOException;
} }
public PutField putFields () throws IOException public PutField putFields () throws IOException
{ {
markFieldsWritten (); markFieldsWritten ();
......
...@@ -47,7 +47,6 @@ import gnu.gcj.convert.UnicodeToBytes; ...@@ -47,7 +47,6 @@ import gnu.gcj.convert.UnicodeToBytes;
* API docs for JDK 1.2 beta from http://www.javasoft.com. * API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct, but only supports 8859_1. * Status: Believed complete and correct, but only supports 8859_1.
*/ */
public class OutputStreamWriter extends Writer public class OutputStreamWriter extends Writer
{ {
BufferedOutputStream out; BufferedOutputStream out;
......
...@@ -62,12 +62,6 @@ public abstract class Writer ...@@ -62,12 +62,6 @@ public abstract class Writer
*/ */
protected Object lock; protected Object lock;
/*************************************************************************/
/*
* Constructors
*/
/** /**
* This is the default no-argument constructor for this class. This method * This is the default no-argument constructor for this class. This method
* will set up the class to synchronize criticial sections on itself. * will set up the class to synchronize criticial sections on itself.
...@@ -77,8 +71,6 @@ public abstract class Writer ...@@ -77,8 +71,6 @@ public abstract class Writer
lock = this; lock = this;
} }
/*************************************************************************/
/** /**
* This method initializes a <code>Writer</code> that will synchronize * This method initializes a <code>Writer</code> that will synchronize
* on the specified <code>Object</code>. * on the specified <code>Object</code>.
...@@ -91,12 +83,6 @@ public abstract class Writer ...@@ -91,12 +83,6 @@ public abstract class Writer
this.lock = lock; this.lock = lock;
} }
/*************************************************************************/
/*
* Instance Methods
*/
/** /**
* This method forces any data that may have been buffered to be written * This method forces any data that may have been buffered to be written
* to the underlying output device. Please note that the host environment * to the underlying output device. Please note that the host environment
...@@ -108,8 +94,6 @@ public abstract class Writer ...@@ -108,8 +94,6 @@ public abstract class Writer
*/ */
public abstract void flush() throws IOException; public abstract void flush() throws IOException;
/*************************************************************************/
/** /**
* This method closes the stream. Any internal or native resources * This method closes the stream. Any internal or native resources
* associated * associated
...@@ -122,8 +106,6 @@ public abstract class Writer ...@@ -122,8 +106,6 @@ public abstract class Writer
*/ */
public abstract void close() throws IOException; public abstract void close() throws IOException;
/*************************************************************************/
/** /**
* This method writes a single char to the output stream. * This method writes a single char to the output stream.
* *
...@@ -139,8 +121,6 @@ public abstract class Writer ...@@ -139,8 +121,6 @@ public abstract class Writer
write(buf, 0, buf.length); write(buf, 0, buf.length);
} }
/*************************************************************************/
/** /**
* This method all the writes char from the passed array to the output * This method all the writes char from the passed array to the output
* stream. This method is equivalent to * stream. This method is equivalent to
...@@ -156,8 +136,6 @@ public abstract class Writer ...@@ -156,8 +136,6 @@ public abstract class Writer
write(buf, 0, buf.length); write(buf, 0, buf.length);
} }
/*************************************************************************/
/** /**
* This method writes <code>len</code> char from the specified array * This method writes <code>len</code> char from the specified array
* <code>buf</code> starting at index <code>offset</code> into the array. * <code>buf</code> starting at index <code>offset</code> into the array.
...@@ -173,8 +151,6 @@ public abstract class Writer ...@@ -173,8 +151,6 @@ public abstract class Writer
public abstract void write(char[] buf, int offset, int len) public abstract void write(char[] buf, int offset, int len)
throws IOException; throws IOException;
/*************************************************************************/
/** /**
* This method writes all the characters in a <code>String</code> to the * This method writes all the characters in a <code>String</code> to the
* output. * output.
...@@ -188,8 +164,6 @@ public abstract class Writer ...@@ -188,8 +164,6 @@ public abstract class Writer
write(str, 0, str.length()); write(str, 0, str.length());
} }
/*************************************************************************/
/** /**
* This method writes <code>len</code> chars from the <code>String</code> * This method writes <code>len</code> chars from the <code>String</code>
* starting at position <code>offset</code>. * starting at position <code>offset</code>.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment