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
This commit is contained in:
parent
228115acf4
commit
ffe4ebba87
10 changed files with 751 additions and 437 deletions
|
@ -1,3 +1,26 @@
|
|||
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
|
||||
|
|
|
@ -596,7 +596,8 @@ public class DataInputStream extends FilterInputStream implements DataInput
|
|||
* character encoding, then they would be converted to a Java
|
||||
* <code>char</code> like so:
|
||||
* <p>
|
||||
* <code>(char)(((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) | (byte3 & 0x3F))</code>
|
||||
* <code>(char)(((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) |
|
||||
* (byte3 & 0x3F))</code>
|
||||
* <p>
|
||||
* 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
|
||||
* <code>writeUTF()</code> method in <code>DataOutput</code>
|
||||
*
|
||||
* @returns The <code>String</code> read
|
||||
* @return The <code>String</code> read
|
||||
*
|
||||
* @exception EOFException If end of file is reached before reading
|
||||
* the String
|
||||
|
|
|
@ -38,40 +38,90 @@ exception statement from your version. */
|
|||
|
||||
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
|
||||
* "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 <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
|
||||
{
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
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
|
||||
* <code>written</code> 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 <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
|
||||
{
|
||||
out.write(b);
|
||||
++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)
|
||||
throws IOException, NullPointerException, IndexOutOfBoundsException
|
||||
{
|
||||
|
@ -79,28 +129,72 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
|
|||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
write ((byte) (0xff & (v >> 8)));
|
||||
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
|
||||
{
|
||||
write ((byte) (0xff & (v >> 8)));
|
||||
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
|
||||
{
|
||||
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 <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
|
||||
{
|
||||
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 <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
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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 <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
|
||||
{
|
||||
int len = s.length();
|
||||
|
@ -145,6 +295,33 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
|
|||
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
|
||||
{
|
||||
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
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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 <warrenl@cygnus.com>
|
||||
* @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 <arenn@urbanophile.com>
|
||||
* @author Warren Levy <warrenl@cygnus.com>
|
||||
* @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 <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
|
||||
{
|
||||
SecurityManager s = System.getSecurityManager();
|
||||
|
@ -61,24 +86,83 @@ public class FileInputStream extends InputStream
|
|||
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
|
||||
{
|
||||
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)
|
||||
{
|
||||
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.
|
||||
* <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
|
||||
{
|
||||
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 <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
|
||||
{
|
||||
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.
|
||||
* <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
|
||||
{
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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.
|
||||
* <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
|
||||
{
|
||||
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
|
||||
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -57,19 +57,19 @@ public class ObjectInputStream extends InputStream
|
|||
implements ObjectInput, ObjectStreamConstants
|
||||
{
|
||||
/**
|
||||
Creates a new <code>ObjectInputStream</code> that will do all of
|
||||
its reading from <code>in</code>. 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 <code>ObjectInputStream</code> that will do all of
|
||||
* its reading from <code>in</code>. 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
|
||||
<code>private void readObject (ObjectInputStream)</code>.
|
||||
|
||||
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
|
||||
<code>InputStream</code>.
|
||||
*/
|
||||
* Returns the next deserialized object read from the underlying stream.
|
||||
*
|
||||
* This method can be overriden by a class by implementing
|
||||
* <code>private void readObject (ObjectInputStream)</code>.
|
||||
*
|
||||
* 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
|
||||
* <code>InputStream</code>.
|
||||
*/
|
||||
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
|
||||
<code>private void readObject (ObjectInputStream)</code>
|
||||
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
|
||||
<code>private void readObject (ObjectInputStream)</code>
|
||||
method.
|
||||
|
||||
@exception IOException Exception from underlying
|
||||
<code>OutputStream</code>.
|
||||
*/
|
||||
* 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
|
||||
* <code>private void readObject (ObjectInputStream)</code>
|
||||
* 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
|
||||
* <code>private void readObject (ObjectInputStream)</code>
|
||||
* method.
|
||||
*
|
||||
* @exception IOException Exception from underlying
|
||||
* <code>OutputStream</code>.
|
||||
*/
|
||||
public void defaultReadObject ()
|
||||
throws ClassNotFoundException, IOException, NotActiveException
|
||||
{
|
||||
|
@ -488,23 +488,23 @@ public class ObjectInputStream extends InputStream
|
|||
|
||||
|
||||
/**
|
||||
Registers a <code>ObjectInputValidation</code> to be carried out
|
||||
on the object graph currently being deserialized before it is
|
||||
returned to the original caller of <code>readObject ()</code>.
|
||||
The order of validation for multiple
|
||||
<code>ObjectInputValidation</code>s can be controled using
|
||||
<code>priority</code>. Validators with higher priorities are
|
||||
called first.
|
||||
|
||||
@see java.io.ObjectInputValidation
|
||||
|
||||
@exception InvalidObjectException <code>validator</code> is
|
||||
<code>null</code>
|
||||
|
||||
@exception NotActiveException an attempt was made to add a
|
||||
validator outside of the <code>readObject</code> method of the
|
||||
object currently being deserialized
|
||||
*/
|
||||
* Registers a <code>ObjectInputValidation</code> to be carried out
|
||||
* on the object graph currently being deserialized before it is
|
||||
* returned to the original caller of <code>readObject ()</code>.
|
||||
* The order of validation for multiple
|
||||
* <code>ObjectInputValidation</code>s can be controled using
|
||||
* <code>priority</code>. Validators with higher priorities are
|
||||
* called first.
|
||||
*
|
||||
* @see java.io.ObjectInputValidation
|
||||
*
|
||||
* @exception InvalidObjectException <code>validator</code> is
|
||||
* <code>null</code>
|
||||
*
|
||||
* @exception NotActiveException an attempt was made to add a
|
||||
* validator outside of the <code>readObject</code> 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
|
||||
<code>annotateClass (Class)</code> method of an
|
||||
<code>ObjectOutputStream</code>.
|
||||
|
||||
This implementation looks up the active call stack for a
|
||||
<code>ClassLoader</code>; if a <code>ClassLoader</code> is found,
|
||||
it is used to load the class associated with <code>osc</code>,
|
||||
otherwise, the default system <code>ClassLoader</code> is used.
|
||||
|
||||
@exception IOException Exception from underlying
|
||||
<code>OutputStream</code>.
|
||||
|
||||
@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
|
||||
* <code>annotateClass (Class)</code> method of an
|
||||
* <code>ObjectOutputStream</code>.
|
||||
*
|
||||
* This implementation looks up the active call stack for a
|
||||
* <code>ClassLoader</code>; if a <code>ClassLoader</code> is found,
|
||||
* it is used to load the class associated with <code>osc</code>,
|
||||
* otherwise, the default system <code>ClassLoader</code> is used.
|
||||
*
|
||||
* @exception IOException Exception from underlying
|
||||
* <code>OutputStream</code>.
|
||||
*
|
||||
* @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
|
||||
<code>OutputStream</code>.
|
||||
|
||||
@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
|
||||
* <code>OutputStream</code>.
|
||||
*
|
||||
* @see #enableResolveObject(boolean)
|
||||
*/
|
||||
protected Object resolveObject (Object obj) throws IOException
|
||||
{
|
||||
return obj;
|
||||
|
@ -600,13 +600,13 @@ public class ObjectInputStream extends InputStream
|
|||
}
|
||||
|
||||
/**
|
||||
If <code>enable</code> is <code>true</code> and this object is
|
||||
trusted, then <code>resolveObject (Object)</code> will be called
|
||||
in subsequent calls to <code>readObject (Object)</code>.
|
||||
Otherwise, <code>resolveObject (Object)</code> will not be called.
|
||||
|
||||
@exception SecurityException This class is not trusted.
|
||||
*/
|
||||
* If <code>enable</code> is <code>true</code> and this object is
|
||||
* trusted, then <code>resolveObject (Object)</code> will be called
|
||||
* in subsequent calls to <code>readObject (Object)</code>.
|
||||
* Otherwise, <code>resolveObject (Object)</code> 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 <code>readObject (Object)</code>. This
|
||||
method does a security check <i>NOTE: currently not
|
||||
implemented</i>, then sets a flag that informs
|
||||
<code>readObject (Object)</code> to call the subclasses
|
||||
<code>readObjectOverride (Object)</code> method.
|
||||
|
||||
@see readObjectOverride (Object)
|
||||
*/
|
||||
* Protected constructor that allows subclasses to override
|
||||
* deserialization. This constructor should be called by subclasses
|
||||
* that wish to override <code>readObject (Object)</code>. This
|
||||
* method does a security check <i>NOTE: currently not
|
||||
* implemented</i>, then sets a flag that informs
|
||||
* <code>readObject (Object)</code> to call the subclasses
|
||||
* <code>readObjectOverride (Object)</code> 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
|
||||
<code>ObjectInputStream</code>. 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
|
||||
* <code>ObjectInputStream</code>. 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)
|
||||
|
|
|
@ -49,86 +49,85 @@ import gnu.java.lang.reflect.TypeSignature;
|
|||
import gnu.classpath.Configuration;
|
||||
|
||||
/**
|
||||
An <code>ObjectOutputStream</code> can be used to write objects
|
||||
as well as primitive data in a platform-independent manner to an
|
||||
<code>OutputStream</code>.
|
||||
|
||||
The data produced by an <code>ObjectOutputStream</code> can be read
|
||||
and reconstituted by an <code>ObjectInputStream</code>.
|
||||
|
||||
<code>writeObject (Object)</code> is used to write Objects, the
|
||||
<code>write<type></code> methods are used to write primitive
|
||||
data (as in <code>DataOutputStream</code>). Strings can be written
|
||||
as objects or as primitive data.
|
||||
|
||||
Not all objects can be written out using an
|
||||
<code>ObjectOutputStream</code>. Only those objects that are an
|
||||
instance of <code>java.io.Serializable</code> 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:
|
||||
<pre>
|
||||
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);
|
||||
</pre>
|
||||
|
||||
The default serialization can be overriden in two ways.
|
||||
|
||||
By defining a method <code>private void
|
||||
writeObject (ObjectOutputStream)</code>, a class can dictate exactly
|
||||
how information about itself is written.
|
||||
<code>defaultWriteObject ()</code> 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 <code>java.io.Externalizable</code>. 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
|
||||
<code>java.io.Externalizable</code>.
|
||||
|
||||
@see java.io.DataOutputStream
|
||||
@see java.io.Externalizable
|
||||
@see java.io.ObjectInputStream
|
||||
@see java.io.Serializable
|
||||
@see XXX: java serialization spec
|
||||
*/
|
||||
* An <code>ObjectOutputStream</code> can be used to write objects
|
||||
* as well as primitive data in a platform-independent manner to an
|
||||
* <code>OutputStream</code>.
|
||||
*
|
||||
* The data produced by an <code>ObjectOutputStream</code> can be read
|
||||
* and reconstituted by an <code>ObjectInputStream</code>.
|
||||
*
|
||||
* <code>writeObject (Object)</code> is used to write Objects, the
|
||||
* <code>write<type></code> methods are used to write primitive
|
||||
* data (as in <code>DataOutputStream</code>). Strings can be written
|
||||
* as objects or as primitive data.
|
||||
*
|
||||
* Not all objects can be written out using an
|
||||
* <code>ObjectOutputStream</code>. Only those objects that are an
|
||||
* instance of <code>java.io.Serializable</code> 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:
|
||||
* <pre>
|
||||
* 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);
|
||||
* </pre>
|
||||
*
|
||||
* The default serialization can be overriden in two ways.
|
||||
*
|
||||
* By defining a method <code>private void
|
||||
* writeObject (ObjectOutputStream)</code>, a class can dictate exactly
|
||||
* how information about itself is written.
|
||||
* <code>defaultWriteObject ()</code> 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 <code>java.io.Externalizable</code>. 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
|
||||
* <code>java.io.Externalizable</code>.
|
||||
*
|
||||
* @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 <code>ObjectOutputStream</code> that will do all of
|
||||
its writing onto <code>out</code>. 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 <code>ObjectOutputStream</code> that will do all of
|
||||
* its writing onto <code>out</code>. 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 <code>obj</code> 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
|
||||
<code>private void writeObject (ObjectOutputStream)</code>.
|
||||
|
||||
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 <code>Object</code> that is not serializable.
|
||||
|
||||
@exception IOException Exception from underlying
|
||||
<code>OutputStream</code>.
|
||||
*/
|
||||
* Writes a representation of <code>obj</code> 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
|
||||
* <code>private void writeObject (ObjectOutputStream)</code>.
|
||||
*
|
||||
* 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 <code>Object</code> that is not serializable.
|
||||
*
|
||||
* @exception IOException Exception from underlying
|
||||
* <code>OutputStream</code>.
|
||||
*/
|
||||
public final void writeObject (Object obj) throws IOException
|
||||
{
|
||||
if (useSubclassMethod)
|
||||
|
@ -494,7 +492,7 @@ public class ObjectOutputStream extends OutputStream
|
|||
@exception IOException if <code>version</code> 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 <code>version</code> 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
|
||||
<code>OutputStream</code>.
|
||||
|
||||
@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
|
||||
<code>OutputStream</code>.
|
||||
|
||||
@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 <code>writeObject (Object)</code>. This
|
||||
method does a security check <i>NOTE: currently not
|
||||
implemented</i>, then sets a flag that informs
|
||||
<code>writeObject (Object)</code> to call the subclasses
|
||||
<code>writeObjectOverride (Object)</code> method.
|
||||
|
||||
@see writeObjectOverride (Object)
|
||||
*/
|
||||
* Protected constructor that allows subclasses to override
|
||||
* serialization. This constructor should be called by subclasses
|
||||
* that wish to override <code>writeObject (Object)</code>. This
|
||||
* method does a security check <i>NOTE: currently not
|
||||
* implemented</i>, then sets a flag that informs
|
||||
* <code>writeObject (Object)</code> to call the subclasses
|
||||
* <code>writeObjectOverride (Object)</code> 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
|
||||
<code>ObjectOutputStream</code>. 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
|
||||
* <code>ObjectOutputStream</code>. 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
|
||||
<code>OutputStream</code>.
|
||||
*/
|
||||
* Causes the block-data buffer to be written to the underlying
|
||||
* stream, but does not flush underlying stream.
|
||||
*
|
||||
* @exception IOException Exception from underlying
|
||||
* <code>OutputStream</code>.
|
||||
*/
|
||||
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 ();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 <bothner@cygnus.com>
|
||||
*/
|
||||
* This abstract class forms the base of the hierarchy of classes that
|
||||
* write output as a stream of chars. It provides a common set of methods
|
||||
* for writing chars to stream. Subclasses implement and/or extend these
|
||||
* methods to write chars in a particular manner or to a particular
|
||||
* destination such as a file on disk or network connection.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @author Per Bothner <bothner@cygnus.com>
|
||||
*/
|
||||
public abstract class Writer
|
||||
{
|
||||
/**
|
||||
* This is the object used to synchronize criticial code sections for
|
||||
* thread safety. Subclasses should use this field instead of using
|
||||
* synchronized methods or explicity synchronizations on <code>this</code>
|
||||
*/
|
||||
* This is the object used to synchronize criticial code sections for
|
||||
* thread safety. Subclasses should use this field instead of using
|
||||
* synchronized methods or explicity synchronizations on <code>this</code>
|
||||
*/
|
||||
protected Object lock;
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
* Constructors
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is the default no-argument constructor for this class. This method
|
||||
* will set up the class to synchronize criticial sections on itself.
|
||||
*/
|
||||
* This is the default no-argument constructor for this class. This method
|
||||
* will set up the class to synchronize criticial sections on itself.
|
||||
*/
|
||||
protected Writer()
|
||||
{
|
||||
lock = this;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* This method initializes a <code>Writer</code> that will synchronize
|
||||
* on the specified <code>Object</code>.
|
||||
*
|
||||
* @param obj The <code>Object</code> to use for synchronizing critical
|
||||
* sections
|
||||
*/
|
||||
* This method initializes a <code>Writer</code> that will synchronize
|
||||
* on the specified <code>Object</code>.
|
||||
*
|
||||
* @param obj The <code>Object</code> to use for synchronizing critical
|
||||
* sections
|
||||
*/
|
||||
protected Writer(Object lock)
|
||||
{
|
||||
this.lock = lock;
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/*
|
||||
* Instance Methods
|
||||
*/
|
||||
|
||||
/**
|
||||
* This method forces any data that may have been buffered to be written
|
||||
* to the underlying output device. Please note that the host environment
|
||||
* might perform its own buffering unbeknowst to Java. In that case, a
|
||||
* write made (for example, to a disk drive) might be cached in OS
|
||||
* buffers instead of actually being written to disk.
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*/
|
||||
* This method forces any data that may have been buffered to be written
|
||||
* to the underlying output device. Please note that the host environment
|
||||
* might perform its own buffering unbeknowst to Java. In that case, a
|
||||
* write made (for example, to a disk drive) might be cached in OS
|
||||
* buffers instead of actually being written to disk.
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*/
|
||||
public abstract void flush() throws IOException;
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* This method closes the stream. Any internal or native resources
|
||||
* associated
|
||||
* with this stream are freed. Any subsequent attempt to access the stream
|
||||
* might throw an exception.
|
||||
* <p>
|
||||
* This method in this class does nothing.
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*/
|
||||
* This method closes the stream. Any internal or native resources
|
||||
* associated
|
||||
* with this stream are freed. Any subsequent attempt to access the stream
|
||||
* might throw an exception.
|
||||
* <p>
|
||||
* This method in this class does nothing.
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*/
|
||||
public abstract void close() throws IOException;
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* This method writes a single char to the output stream.
|
||||
*
|
||||
* @param b The char to be written to the output stream, passed as an int
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*/
|
||||
* 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
|
||||
* <code>write(buf, 0, buf.length)</code> which
|
||||
* is exactly how it is implemented in this class.
|
||||
*
|
||||
* @param buf The array of char to write
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*/
|
||||
* This method all the writes char from the passed array to the output
|
||||
* stream. This method is equivalent to
|
||||
* <code>write(buf, 0, buf.length)</code> which
|
||||
* is exactly how it is implemented in this class.
|
||||
*
|
||||
* @param buf The array of char to write
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*/
|
||||
public void write(char[] buf) throws IOException
|
||||
{
|
||||
write(buf, 0, buf.length);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* This method writes <code>len</code> char from the specified array
|
||||
* <code>buf</code> starting at index <code>offset</code> into the array.
|
||||
* <p>
|
||||
* Subclasses must provide an implementation of this abstract method.
|
||||
*
|
||||
* @param buf The array of char to write from
|
||||
* @param offset The index into the array to start writing from
|
||||
* @param len The number of char to write
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*/
|
||||
* This method writes <code>len</code> char from the specified array
|
||||
* <code>buf</code> starting at index <code>offset</code> into the array.
|
||||
* <p>
|
||||
* Subclasses must provide an implementation of this abstract method.
|
||||
*
|
||||
* @param buf The array of char to write from
|
||||
* @param offset The index into the array to start writing from
|
||||
* @param len The number of char to write
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*/
|
||||
public abstract void write(char[] buf, int offset, int len)
|
||||
throws IOException;
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* This method writes all the characters in a <code>String</code> to the
|
||||
* output.
|
||||
*
|
||||
* @param str The <code>String</code> whose chars are to be written.
|
||||
*
|
||||
* @param IOException If an error occurs
|
||||
*/
|
||||
* This method writes all the characters in a <code>String</code> to the
|
||||
* output.
|
||||
*
|
||||
* @param str The <code>String</code> whose chars are to be written.
|
||||
*
|
||||
* @param IOException If an error occurs
|
||||
*/
|
||||
public void write(String str) throws IOException
|
||||
{
|
||||
write(str, 0, str.length());
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* This method writes <code>len</code> chars from the <code>String</code>
|
||||
* starting at position <code>offset</code>.
|
||||
*
|
||||
* @param str The <code>String</code> that is to be written
|
||||
* @param offset The character offset into the <code>String</code> to start
|
||||
* writing from
|
||||
* @param len The number of chars to write
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*/
|
||||
* This method writes <code>len</code> chars from the <code>String</code>
|
||||
* starting at position <code>offset</code>.
|
||||
*
|
||||
* @param str The <code>String</code> that is to be written
|
||||
* @param offset The character offset into the <code>String</code> to start
|
||||
* writing from
|
||||
* @param len The number of chars to write
|
||||
*
|
||||
* @exception IOException If an error occurs
|
||||
*/
|
||||
public void write(String str, int offset, int len) throws IOException
|
||||
{
|
||||
// FIXME - for libgcj re-write using native code to not require
|
||||
|
|
Loading…
Add table
Reference in a new issue