BufferedOutputStream.java, [...]: More merges from classpath.

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

	* java/io/BufferedOutputStream.java,
	java/io/DataInput.java,
	java/io/DataInputStream.java,
	java/io/DataOutput.java,
	java/io/Externalizable.java:
	More merges from classpath.

From-SVN: r64528
This commit is contained in:
Michael Koch 2003-03-18 07:50:19 +00:00 committed by Michael Koch
parent 71a15b1586
commit fddab7dc9b
6 changed files with 730 additions and 739 deletions

View file

@ -1,3 +1,12 @@
2003-03-18 Michael Koch <konqueror@gmx.de>
* java/io/BufferedOutputStream.java,
java/io/DataInput.java,
java/io/DataInputStream.java,
java/io/DataOutput.java,
java/io/Externalizable.java:
More merges from classpath.
2003-03-18 Michael Koch <konqueror@gmx.de>
* configure.in: Fixed links to platform dependant java.net files.

View file

@ -46,15 +46,10 @@ package java.io;
* efficient mechanism for writing versus doing numerous small unbuffered
* writes.
*
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class BufferedOutputStream extends FilterOutputStream
{
/*************************************************************************/
/*
* Class Variables
*/
@ -96,8 +91,7 @@ protected int count;
*
* @param out The underlying <code>OutputStream</code> to write data to
*/
public
BufferedOutputStream(OutputStream out)
public BufferedOutputStream(OutputStream out)
{
this(out, DEFAULT_BUFFER_SIZE);
}
@ -112,8 +106,7 @@ BufferedOutputStream(OutputStream out)
* @param out The underlying <code>OutputStream</code> to write data to
* @param size The size of the internal buffer
*/
public
BufferedOutputStream(OutputStream out, int size)
public BufferedOutputStream(OutputStream out, int size)
{
super(out);
@ -132,8 +125,7 @@ BufferedOutputStream(OutputStream out, int size)
*
* @exception IOException If an error occurs
*/
public synchronized void
flush() throws IOException
public synchronized void flush() throws IOException
{
if (count == 0)
return;
@ -150,8 +142,7 @@ flush() throws IOException
* underlying output stream. Any further attempts to write to this stream
* may throw an exception
*
public synchronized void
close() throws IOException
public synchronized void close() throws IOException
{
flush();
out.close();
@ -167,8 +158,7 @@ close() throws IOException
*
* @exception IOException If an error occurs (ignored by the Java runtime)
*
protected void
finalize() throws IOException
protected void finalize() throws IOException
{
close();
}
@ -186,8 +176,7 @@ finalize() throws IOException
*
* @exception IOException If an error occurs
*/
public synchronized void
write(int b) throws IOException
public synchronized void write(int b) throws IOException
{
if (count == buf.length)
flush();
@ -211,8 +200,8 @@ write(int b) throws IOException
*
* @exception IOException If an error occurs
*/
public synchronized void
write(byte[] buf, int offset, int len) throws IOException
public synchronized void write(byte[] buf, int offset, int len)
throws IOException
{
// Buffer can hold everything. Note that the case where LEN < 0
// is automatically handled by the downstream write.
@ -232,3 +221,4 @@ write(byte[] buf, int offset, int len) throws IOException
}
} // class BufferedOutputStream

View file

@ -1,5 +1,5 @@
/* DataInput.java -- Interface for reading data from a stream
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -41,8 +41,7 @@ package java.io;
/* 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.
*/
* Status: Believed complete and correct. */
/**
* This interface is implemented by classes that can data from streams
@ -66,11 +65,11 @@ public interface DataInput
*
* @return The <code>boolean</code> value read
*
* @exception EOFException If end of file is reached before reading the boolean
* @exception EOFException If end of file is reached before
* reading the boolean
* @exception IOException If any other error occurs
*/
boolean
readBoolean() throws EOFException, IOException;
boolean readBoolean() throws EOFException, IOException;
/*************************************************************************/
@ -89,8 +88,7 @@ readBoolean() throws EOFException, IOException;
*
* @see DataOutput
*/
byte
readByte() throws EOFException, IOException;
byte readByte() throws EOFException, IOException;
/*************************************************************************/
@ -98,7 +96,8 @@ readByte() throws EOFException, IOException;
* This method reads 8 unsigned bits into a Java <code>int</code> value from
* the stream. The value returned is in the range of 0 to 255.
* <p>
* This method can read an unsigned byte written by an object implementing the
* This method can read an unsigned byte written by an object
* implementing the
* <code>writeUnsignedByte()</code> method in the <code>DataOutput</code>
* interface.
*
@ -109,8 +108,7 @@ readByte() throws EOFException, IOException;
*
* @see DataOutput
*/
int
readUnsignedByte() throws EOFException, IOException;
int readUnsignedByte() throws EOFException, IOException;
/*************************************************************************/
@ -138,8 +136,7 @@ readUnsignedByte() throws EOFException, IOException;
*
* @see DataOutput
*/
char
readChar() throws EOFException, IOException;
char readChar() throws EOFException, IOException;
/*************************************************************************/
@ -158,7 +155,8 @@ readChar() throws EOFException, IOException;
* <p>
* The value returned is in the range of -32768 to 32767.
* <p>
* This method can read a <code>short</code> written by an object implementing
* This method can read a <code>short</code> written by an object
* implementing
* the <code>writeShort()</code> method in the <code>DataOutput</code>
* interface.
*
@ -169,8 +167,7 @@ readChar() throws EOFException, IOException;
*
* @see DataOutput
*/
short
readShort() throws EOFException, IOException;
short readShort() throws EOFException, IOException;
/*************************************************************************/
@ -190,16 +187,17 @@ readShort() throws EOFException, IOException;
* The value returned is in the range of 0 to 65535.
* <p>
* This method can read an unsigned short written by an object implementing
* the <code>writeUnsignedShort()</code> method in the <code>DataOutput</code>
* the <code>writeUnsignedShort()</code> method in the
* <code>DataOutput</code>
* interface.
*
* @return The unsigned short value read as a Java <code>int</code>.
*
* @exception EOFException If end of file is reached before reading the value
* @exception EOFException If end of file is reached before reading
* the value
* @exception IOException If any other error occurs
*/
int
readUnsignedShort() throws EOFException, IOException;
int readUnsignedShort() throws EOFException, IOException;
/*************************************************************************/
@ -216,10 +214,11 @@ readUnsignedShort() throws EOFException, IOException;
* <p>
* <code>(int)((byte1 << 24) + (byte2 << 16) + (byte3 << 8) + byte4))</code>
* <p>
The value returned is in the range of -2147483648 to 2147483647.
* The value returned is in the range of -2147483648 to 2147483647.
* <p>
* This method can read an <code>int</code> written by an object implementing
* the <code>writeInt()</code> method in the <code>DataOutput</code> interface.
* This method can read an <code>int</code> written by an object
* implementing the <code>writeInt()</code> method in the
* <code>DataOutput</code> interface.
*
* @return The <code>int</code> value read
*
@ -228,8 +227,7 @@ readUnsignedShort() throws EOFException, IOException;
*
* @see DataOutput
*/
int
readInt() throws EOFException, IOException;
int readInt() throws EOFException, IOException;
/*************************************************************************/
@ -251,9 +249,9 @@ readInt() throws EOFException, IOException;
* The value returned is in the range of -9223372036854775808 to
* 9223372036854775807.
* <p>
* This method can read an <code>long</code> written by an object implementing
* the <code>writeLong()</code> method in the <code>DataOutput</code>
* interface.
* This method can read an <code>long</code> written by an object
* implementing the <code>writeLong()</code> method in the
* <code>DataOutput</code> interface.
*
* @return The <code>long</code> value read
*
@ -262,8 +260,7 @@ readInt() throws EOFException, IOException;
*
* @see DataOutput
*/
long
readLong() throws EOFException, IOException;
long readLong() throws EOFException, IOException;
/*************************************************************************/
@ -275,20 +272,21 @@ readLong() throws EOFException, IOException;
* <code>intBitsToFloat</code> method in the class
* <code>java.lang.Float</code>.
* <p>
* This method can read a <code>float</code> written by an object implementing
* This method can read a <code>float</code> written by an object
* implementing
* the <code>writeFloat()</code> method in the <code>DataOutput</code>
* interface.
*
* @return The <code>float</code> value read
*
* @exception EOFException If end of file is reached before reading the float
* @exception EOFException If end of file is reached before reading the
* float
* @exception IOException If any other error occurs
*
* @see java.lang.Float
* @see DataOutput
*/
float
readFloat() throws EOFException, IOException;
float readFloat() throws EOFException, IOException;
/*************************************************************************/
@ -306,26 +304,28 @@ readFloat() throws EOFException, IOException;
*
* @return The <code>double</code> value read
*
* @exception EOFException If end of file is reached before reading the double
* @exception EOFException If end of file is reached before reading the
* double
* @exception IOException If any other error occurs
*
* @see java.lang.Double
* @see DataOutput
*/
double
readDouble() throws EOFException, IOException;
double readDouble() throws EOFException, IOException;
/*************************************************************************/
/**
* This method reads the next line of text data from an input stream.
* It operates by reading bytes and converting those bytes to <code>char</code>
* It operates by reading bytes and converting those bytes to
* <code>char</code>
* values by treating the byte read as the low eight bits of the
* <code>char</code> and using 0 as the high eight bits. Because of this,
* it does not support the full 16-bit Unicode character set.
* <P>
* The reading of bytes ends when either the end of file or a line terminator
* is encountered. The bytes read are then returned as a <code>String</code>.
* is encountered. The bytes read are then returned as a
* <code>String</code>.
* A line terminator is a byte sequence consisting of either
* <code>\r</code>, <code>\n</code> or <code>\r\n</code>. These termination
* charaters are discarded and are not returned as part of the string.
@ -339,22 +339,22 @@ readDouble() throws EOFException, IOException;
*
* @see DataOutput
*/
String
readLine() throws IOException;
String readLine() throws IOException;
/*************************************************************************/
/**
* This method reads a <code>String</code> from an input stream that is
* encoded in a modified UTF-8 format. This format has a leading two byte
* sequence that contains the remaining number of bytes to read. This two byte
* sequence that contains the remaining number of bytes to read.
* This two byte
* sequence is read using the <code>readUnsignedShort()</code> method of this
* interface.
*
* After the number of remaining bytes have been determined, these bytes
* are read an transformed into <code>char</code> values. These
* <code>char</code> values are encoded in the stream using either a one, two,
* or three byte format.
* <code>char</code> values are encoded in the stream using either a one,
* two, or three byte format.
* The particular format in use can be determined by examining the first
* byte read.
* <p>
@ -398,23 +398,23 @@ readLine() throws IOException;
*
* Note that all characters are encoded in the method that requires the
* fewest number of bytes with the exception of the character with the
* value of <code>\<llll>u0000</code> which is encoded as two bytes. This is
* a modification of the UTF standard used to prevent C language style
* <code>NUL</code> values from appearing in the byte stream.
* value of <code>\<llll>u0000</code> which is encoded as two bytes.
* This is a modification of the UTF standard used to prevent C language
* style <code>NUL</code> values from appearing in the byte stream.
* <p>
* This method can read data that was written by an object implementing the
* <code>writeUTF()</code> method in <code>DataOutput</code>.
*
* @returns The <code>String</code> read
*
* @exception EOFException If end of file is reached before reading the String
* @exception EOFException If end of file is reached before reading the
* String
* @exception UTFDataFormatException If the data is not in UTF-8 format
* @exception IOException If any other error occurs
*
* @see DataOutput
*/
String
readUTF() throws EOFException, UTFDataFormatException, IOException;
String readUTF() throws EOFException, UTFDataFormatException, IOException;
/*************************************************************************/
@ -426,17 +426,19 @@ readUTF() throws EOFException, UTFDataFormatException, IOException;
*
* @param buf The buffer into which to read the data
*
* @exception EOFException If end of file is reached before filling the buffer
* @exception EOFException If end of file is reached before filling the
* buffer
* @exception IOException If any other error occurs
*/
void
readFully(byte[] buf) throws EOFException, IOException;
void readFully(byte[] buf) throws EOFException, IOException;
/*************************************************************************/
/**
* This method reads raw bytes into the passed array <code>buf</code> starting
* <code>offset</code> bytes into the buffer. The number of bytes read will be
* This method reads raw bytes into the passed array <code>buf</code>
* starting
* <code>offset</code> bytes into the buffer. The number of bytes read
* will be
* exactly <code>len</code>. Note that this method blocks until the data is
* available and * throws an exception if there is not enough data left in
* the stream to read <code>len</code> bytes.
@ -445,11 +447,12 @@ readFully(byte[] buf) throws EOFException, IOException;
* @param offset The offset into the buffer to start storing data
* @param len The number of bytes to read into the buffer
*
* @exception EOFException If end of file is reached before filling the buffer
* @exception EOFException If end of file is reached before filling the
* buffer
* @exception IOException If any other error occurs
*/
void
readFully(byte[] buf, int offset, int len) throws EOFException, IOException;
void readFully(byte[] buf, int offset, int len)
throws EOFException, IOException;
/*************************************************************************/
@ -466,7 +469,6 @@ readFully(byte[] buf, int offset, int len) throws EOFException, IOException;
* skipped
* @exception IOException If any other error occurs
*/
int
skipBytes(int n) throws EOFException, IOException;
int skipBytes(int n) throws EOFException, IOException;
} // interface DataInput

View file

@ -1,5 +1,5 @@
/* DataInputStream.java -- FilteredInputStream that implements DataInput
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation
This file is part of GNU Classpath.
@ -50,8 +50,6 @@ package java.io;
*
* @see DataInput
*
* @version 0.0
*
* @author Warren Levy <warrenl@cygnus.com>
* @author Aaron M. Renn (arenn@urbanophile.com)
* @date October 20, 1998.

View file

@ -60,8 +60,7 @@ public interface DataOutput
*
* @exception IOException If an error occurs
*/
void
writeBoolean(boolean value) throws IOException;
void writeBoolean(boolean value) throws IOException;
/*************************************************************************/
@ -72,8 +71,7 @@ writeBoolean(boolean value) throws IOException;
*
* @exception IOException If an error occurs
*/
void
writeByte(int value) throws IOException;
void writeByte(int value) throws IOException;
/*************************************************************************/
@ -84,8 +82,7 @@ writeByte(int value) throws IOException;
*
* @exception IOException If an error occurs
*/
void
writeChar(int value) throws IOException;
void writeChar(int value) throws IOException;
/*************************************************************************/
@ -96,8 +93,7 @@ writeChar(int value) throws IOException;
*
* @exception IOException If an error occurs
*/
void
writeShort(int value) throws IOException;
void writeShort(int value) throws IOException;
/*************************************************************************/
@ -108,8 +104,7 @@ writeShort(int value) throws IOException;
*
* @exception IOException If an error occurs
*/
void
writeInt(int value) throws IOException;
void writeInt(int value) throws IOException;
/*************************************************************************/
@ -120,8 +115,7 @@ writeInt(int value) throws IOException;
*
* @exception IOException If an error occurs
*/
void
writeLong(long value) throws IOException;
void writeLong(long value) throws IOException;
/*************************************************************************/
@ -132,8 +126,7 @@ writeLong(long value) throws IOException;
*
* @exception IOException If an error occurs
*/
void
writeFloat(float value) throws IOException;
void writeFloat(float value) throws IOException;
/*************************************************************************/
@ -144,8 +137,7 @@ writeFloat(float value) throws IOException;
*
* @exception IOException If any other error occurs
*/
void
writeDouble(double value) throws IOException;
void writeDouble(double value) throws IOException;
/*************************************************************************/
@ -156,8 +148,7 @@ writeDouble(double value) throws IOException;
*
* @exception IOException If an error occurs
*/
void
writeBytes(String value) throws IOException;
void writeBytes(String value) throws IOException;
/*************************************************************************/
@ -168,8 +159,7 @@ writeBytes(String value) throws IOException;
*
* @exception IOException If an error occurs
*/
void
writeChars(String value) throws IOException;
void writeChars(String value) throws IOException;
/*************************************************************************/
@ -181,8 +171,7 @@ writeChars(String value) throws IOException;
*
* @exception IOException If an error occurs
*/
void
writeUTF(String value) throws IOException;
void writeUTF(String value) throws IOException;
/*************************************************************************/
@ -194,8 +183,7 @@ writeUTF(String value) throws IOException;
*
* @exception IOException If an error occurs
*/
void
write(int value) throws IOException;
void write(int value) throws IOException;
/*************************************************************************/
@ -206,23 +194,24 @@ write(int value) throws IOException;
*
* @exception IOException If an error occurs
*/
void
write(byte[] buf) throws IOException;
void write(byte[] buf) throws IOException;
/*************************************************************************/
/**
* This method writes raw bytes from the passed array <code>buf</code> starting
* <code>offset</code> bytes into the buffer. The number of bytes written will be
* exactly <code>len</code>.
* This method writes raw bytes from the passed array <code>buf</code>
* starting
* <code>offset</code> bytes into the buffer. The number of bytes
* written will be * exactly <code>len</code>.
*
* @param buf The buffer from which to write the data
* @param offset The offset into the buffer to start writing data from
* @param len The number of bytes to write from the buffer to the output stream
* @param len The number of bytes to write from the buffer to the output
* stream
*
* @exception IOException If any other error occurs
*/
void
write(byte[] buf, int offset, int len) throws IOException;
void write(byte[] buf, int offset, int len) throws IOException;
} // interface DataOutput

View file

@ -56,8 +56,6 @@ package java.io;
* created using the default no-argument constructor and the
* <code>readExternal</code> method is used to restore the state.
*
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public interface Externalizable extends Serializable
@ -67,8 +65,10 @@ public interface Externalizable extends Serializable
/**
* This method restores an object's state by reading in the instance data
* for the object from the passed in stream. Note that this stream is not
* a subclass of <code>InputStream</code>, but rather is a class that implements
* the <code>ObjectInput</code> interface. That interface provides a mechanism for
* a subclass of <code>InputStream</code>, but rather is a class that
* implements
* the <code>ObjectInput</code> interface. That interface provides a
* mechanism for
* reading in Java data types from a stream.
* <p>
* Note that this method must be compatible with <code>writeExternal</code>.
@ -79,13 +79,15 @@ public interface Externalizable extends Serializable
* for that object must be found and loaded. If that operation fails,
* then this method throws a <code>ClassNotFoundException</code>
*
* @param in An <code>ObjectInput</code> instance for reading in the object state
* @param in An <code>ObjectInput</code> instance for reading in the object
* state
*
* @exception ClassNotFoundException If the class of an object being restored cannot be found
* @exception ClassNotFoundException If the class of an object being
* restored cannot be found
* @exception IOException If any other error occurs
*/
public abstract void
readExternal(ObjectInput in) throws ClassNotFoundException, IOException;
public abstract void readExternal(ObjectInput in)
throws ClassNotFoundException, IOException;
/*************************************************************************/
@ -93,18 +95,19 @@ readExternal(ObjectInput in) throws ClassNotFoundException, IOException;
* This method is responsible for writing the instance data of an object
* to the passed in stream. Note that this stream is not a subclass of
* <code>OutputStream</code>, but rather is a class that implements the
* <code>ObjectOutput</code> interface. That interface provides a number of methods
* <code>ObjectOutput</code> interface. That interface provides a
* number of methods
* for writing Java data values to a stream.
* <p>
* Not that the implementation of this method must be coordinated with
* the implementation of <code>readExternal</code>.
*
* @param out An <code>ObjectOutput</code> instance for writing the object state
* @param out An <code>ObjectOutput</code> instance for writing the
* object state
*
* @exception IOException If an error occurs
*/
public abstract void
writeExternal(ObjectOutput out) throws IOException;
public abstract void writeExternal(ObjectOutput out) throws IOException;
} // interface Externalizable