Commit 34442f32 by Tom Tromey Committed by Tom Tromey

BufferedOutputStream.java: Re-merged with Classpath.

	* java/io/BufferedOutputStream.java: Re-merged with Classpath.
	* java/io/CharConversionException.java: Likewise.
	* java/io/EOFException.java: Likewise.
	* java/io/FileNotFoundException.java: Likewise.
	* java/io/IOException.java: Likewise.
	* java/io/InterruptedIOException.java: Likewise.
	* java/io/InvalidClassException.java: Likewise.
	* java/io/InvalidObjectException.java: Likewise.
	* java/io/NotActiveException.java: Likewise.
	* java/io/NotSerializableException.java: Likewise.
	* java/io/ObjectStreamException.java: Likewise.
	* java/io/ObjectStreamConstants.java: Likewise.
	* java/io/OptionalDataException.java: Likewise.
	* java/io/PipedInputStream.java: Likewise.
	* java/io/PushbackInputStream.java: Likewise.
	* java/io/StreamCorruptedException.java: Likewise.
	* java/io/SyncFailedException.java: Likewise.
	* java/io/UTFDataFormatException.java: Likewise.
	* java/io/UnsupportedEncodingException.java: Likewise.
	* java/io/WriteAbortedException.java: Likewise.

From-SVN: r54655
parent 945dabcd
2002-06-15 Tom Tromey <tromey@redhat.com>
* java/io/BufferedOutputStream.java: Re-merged with Classpath.
* java/io/CharConversionException.java: Likewise.
* java/io/EOFException.java: Likewise.
* java/io/FileNotFoundException.java: Likewise.
* java/io/IOException.java: Likewise.
* java/io/InterruptedIOException.java: Likewise.
* java/io/InvalidClassException.java: Likewise.
* java/io/InvalidObjectException.java: Likewise.
* java/io/NotActiveException.java: Likewise.
* java/io/NotSerializableException.java: Likewise.
* java/io/ObjectStreamException.java: Likewise.
* java/io/ObjectStreamConstants.java: Likewise.
* java/io/OptionalDataException.java: Likewise.
* java/io/PipedInputStream.java: Likewise.
* java/io/PushbackInputStream.java: Likewise.
* java/io/StreamCorruptedException.java: Likewise.
* java/io/SyncFailedException.java: Likewise.
* java/io/UTFDataFormatException.java: Likewise.
* java/io/UnsupportedEncodingException.java: Likewise.
* java/io/WriteAbortedException.java: Likewise.
2002-06-15 Nathanael Nerode <neroden@twcny.rr.com>
* java/text/ChoiceFormat.java: Update comments from Classpath.
......
......@@ -140,6 +140,7 @@ flush() throws IOException
out.write(buf, 0, count);
count = 0;
out.flush();
}
/*************************************************************************/
......
/* CharConversionException.java -- Character conversion exceptions
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -38,49 +38,36 @@ exception statement from your version. */
package java.io;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
* Status: Complete to 1.1.
*/
/**
* This exception is thrown to indicate that a problem occurred with
* an attempted character conversion.
*
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@cygnus.com>
* @date September 25, 1998
* @since 1.1
* @status updated to 1.4
*/
public class CharConversionException extends IOException
{
/*
* Constructors
/**
* Compatible with JDK 1.1+.
*/
private static final long serialVersionUID = -8680016352018427031L;
/**
* Create a new CharConversionException without a descriptive error message
/**
* Create an exception without a descriptive error message.
*/
public
CharConversionException()
{
super();
}
public CharConversionException()
{
}
/*************************************************************************/
/**
* Create a new CharConversionException with a descriptive error message String
/**
* Create an exception with a descriptive error message.
*
* @param message The descriptive error message
* @param message the descriptive error message
*/
public
CharConversionException(String message)
{
public CharConversionException(String message)
{
super(message);
}
}
} // class CharConversionException
/* EOFException.java -- Unexpected end of file exception
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
/* EOFException.java -- unexpected end of file exception
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -38,53 +38,39 @@ exception statement from your version. */
package java.io;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
* Status: Complete to 1.1.
*/
/**
* This exception is thrown when the end of the file or stream was
* encountered unexpectedly. This is not the normal way that a normal
* EOF condition is reported. Normally a special value such as -1 is
* returned. However, certain types of streams expecting certain data
* in a certain format might reach EOF before reading their expected
* data pattern and thus throw this exception.
*
* @version 0.0
* encountered unexpectedly. This is not the normal way that an EOF
* condition is reported; such as a special value like -1 being returned.
* However, certain types of streams expecting certain data in a certain
* format might reach EOF before reading their expected data pattern and
* thus throw this exception.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@cygnus.com>
* @date September 24, 1998
* @status updated to 1.4
*/
public class EOFException extends IOException
{
/*
* Constructors
/**
* Compatible with JDK 1.0+.
*/
private static final long serialVersionUID = 6433858223774886977L;
/**
* Create a new EOFException without a descriptive error message
/**
* Create an exception without a descriptive error message.
*/
public
EOFException()
{
super();
}
public EOFException()
{
}
/*************************************************************************/
/**
* Create a new EOFException with a descriptive error message String
/**
* Create an exception with a descriptive error message.
*
* @param message The descriptive error message
* @param message the descriptive error message
*/
public
EOFException(String message)
{
public EOFException(String message)
{
super(message);
}
}
} // class EOFException
/* FileNotFoundException.java -- The requested file could not be found
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
/* FileNotFoundException.java -- the requested file could not be found
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -38,49 +38,36 @@ exception statement from your version. */
package java.io;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
* Status: Complete to 1.1.
*/
/**
* This exception is thrown when an attempt is made to access a file that
* does not exist.
*
* @version 0.0
* does not exist, or is inaccessible for some other reason (such as writing
* a read-only file).
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Aaron M. Renn <arenn@urbanophile.com>
* @author Tom Tromey <tromey@cygnus.com>
* @date September 24, 1998
* @status updated to 1.4
*/
public class FileNotFoundException extends IOException
{
/*
* Constructors
/**
* Compatible with JDK 1.0+.
*/
private static final long serialVersionUID = -897856973823710492L;
/**
* Create a new FileNotFoundException without a descriptive error message
/**
* Create an exception without a descriptive error message.
*/
public
FileNotFoundException()
{
super();
}
public FileNotFoundException()
{
}
/*************************************************************************/
/**
* Create a new FileNotFoundException with a descriptive error message String
/**
* Create an exception with a descriptive error message.
*
* @param message The descriptive error message
* @param message the descriptive error message
*/
public
FileNotFoundException(String message)
{
public FileNotFoundException(String message)
{
super(message);
}
}
} // class FileNotFoundException
/* IOException.java -- Generic input/output exception
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -38,51 +38,37 @@ exception statement from your version. */
package java.io;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
* Status: Complete to 1.1.
*/
/**
* This exception is thrown to indicate an I/O problem of some sort
* occurred. Since this is a fairly generic exception, often a subclass
* of IOException will actually be thrown in order to provide a more
* detailed indication of what happened.
*
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@cygnus.com>
* @date September 24, 1998
* @status updated to 1.4
*/
public class IOException extends Exception
{
/*
* Constructors
/**
* Compatible with JDK 1.0+.
*/
private static final long serialVersionUID = 7818375828146090155L;
/**
* Create a new IOException without a descriptive error message
/**
* Create an exception without a descriptive error message.
*/
public
IOException()
{
super();
}
public IOException()
{
}
/*************************************************************************/
/**
* Create a new IOException with a descriptive error message String
/**
* Create an exception with a descriptive error message.
*
* @param message The descriptive error message
* @param message the descriptive error message
*/
public
IOException(String message)
{
public IOException(String message)
{
super(message);
}
}
} // class IOException
/* InterruptedIOException.java -- An I/O operation was interrupted.
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
/* InterruptedIOException.java -- an I/O operation was interrupted
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -38,78 +38,57 @@ exception statement from your version. */
package java.io;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
* Status: Complete to 1.1.
*/
/**
* This exception is thrown when a in process I/O operation is
* interrupted for some reason. The field bytesTransferred will contain
* the number of bytes that were read/written prior to the interruption.
*
* @version 0.0
* This exception is thrown when a in process I/O operation is interrupted
* for some reason. The field bytesTransferred will contain the number of
* bytes that were read/written prior to the interruption.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Aaron M. Renn <arenn@urbanophile.com>
* @author Tom Tromey <tromey@cygnus.com>
* @date September 24, 1998
* @see Thread#interrupt()
* @status updated to 1.4
*/
public class InterruptedIOException extends IOException
{
private static final long serialVersionUID = 4020568460727500567L;
/*
* Instance Variables
/**
* Compatible with JDK 1.0+.
*/
private static final long serialVersionUID = 4020568460727500567L;
/**
* The number of bytes read/written prior to the interruption
*/
public int bytesTransferred;
/*************************************************************************/
/*
* Constructors
/**
* The number of bytes read/written prior to the interruption.
*
* @serial count of bytes successfully transferred
*/
public int bytesTransferred;
/**
* Create a new InterruptedIOException without a descriptive error message
/**
* Create an extends without a descriptive error message.
*/
public
InterruptedIOException()
{
super();
}
/*************************************************************************/
public InterruptedIOException()
{
}
/**
* Create a new InterruptedIOException with a descriptive error message String
/**
* Create an exception with a descriptive error message.
*
* @param message The descriptive error message
* @param message the descriptive error message
*/
public
InterruptedIOException(String message)
{
public InterruptedIOException(String message)
{
super(message);
}
}
/*************************************************************************/
/**
* Create a new InterruptedIOException with a descriptive error message
* String. Also sets the value of the bytesTransferred field.
/**
* Create an exception with a descriptive error message and count of
* bytes transferred.
*
* @param message The descriptive error message
* @param bytesTransferred The number of bytes tranferred before the interruption
* @param message the descriptive error message
* @param bytesTransferred number of bytes tranferred before interruption
*/
InterruptedIOException(String message, int bytesTransferred)
{
InterruptedIOException(String message, int bytesTransferred)
{
super(message);
this.bytesTransferred = bytesTransferred;
}
}
} // class InterruptedIOException
/* InvalidClassException.java -- An I/O operation was interrupted.
Copyright (C) 1998 Free Software Foundation, Inc.
/* InvalidClassException.java -- deserializing a class failed
Copyright (C) 1998, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -40,30 +40,40 @@ package java.io;
/**
* This exception is thrown when there is some sort of problem with a
* class during a serialization operation. This could be that the
* versions don't match, that there are unknown datatypes in the class
* or that the class doesn't have a default no-arg constructor.
* <p>
* The field <code>classname</code> will contain the name of the
* class during a serialization operation. This could be:<br><ul>
* <li>the serial version of the class doesn't match</li>
* <li>the class contains unknown datatypes</li>
* <li>the class does not have an accessible no-arg constructor</li>
* </ul>.
*
* <p>The field <code>classname</code> will contain the name of the
* class that caused the problem if known. The getMessage() method
* for this exception will always include the name of that class
* if known.
*
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.1
* @status updated to 1.4
*/
public class InvalidClassException extends ObjectStreamException
{
/**
* Compatible with JDK 1.1+.
*/
private static final long serialVersionUID = -4333316296251054416L;
/**
* The name of the class which encountered the error.
*
* @serial the classname causing the error
*/
public String classname;
/**
* Create a new InvalidClassException with a descriptive error message String
* Create an exception with a descriptive error message, but a null
* classname.
*
* @param message The descriptive error message
* @param message the descriptive error message
*/
public InvalidClassException(String message)
{
......@@ -71,11 +81,11 @@ public class InvalidClassException extends ObjectStreamException
}
/**
* Create a new InvalidClassException with a descriptive error message
* String, and the name of the class that caused the problem.
* Create an exception with a descriptive error message, and the name of
* the class that caused the problem.
*
* @param classname The number of bytes tranferred before the interruption
* @param message The descriptive error message
* @param classname the name of the faulty class
* @param message the descriptive error message
*/
public InvalidClassException(String classname, String message)
{
......@@ -85,14 +95,17 @@ public class InvalidClassException extends ObjectStreamException
/**
* Returns the descriptive error message for this exception. It will
* include the class name that caused the problem if known. This method
* overrides Throwable.getMessage()
* include the class name that caused the problem if known, in the format:
* <code>[classname][; ][super.getMessage()]</code>.
*
* @return A descriptive error message
* @return A descriptive error message, may be null
*/
public String getMessage()
{
return super.getMessage() + (classname == null ? "" : ": " + classname);
String msg = super.getMessage();
if (msg == null)
return classname;
return (classname == null ? "" : classname + "; ") + msg;
}
}
/* InvalidObjectException.java -- An I/O operation was interrupted.
Copyright (C) 1998 Free Software Foundation, Inc.
/* InvalidObjectException.java -- deserialization failed verification
Copyright (C) 1998, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -42,27 +42,25 @@ package java.io;
* This exception is thrown when an object fails a validation test
* during serialization.
*
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.1
* @status updated to 1.4
*/
public class InvalidObjectException extends ObjectStreamException
{
/*
* Constructors
/**
* Compatible with JDK 1.1+.
*/
private static final long serialVersionUID = 3233174318281839583L;
/**
* Create a new InvalidObjectException with a descriptive error message String
/**
* Create an exception with a descriptive error message String. This should
* be the cause of the verification failure.
*
* @param message The descriptive error message
* @param message the descriptive error message
*/
public
InvalidObjectException(String message)
{
public InvalidObjectException(String message)
{
super(message);
}
}
} // class InvalidObjectException
/* NotActiveException.java -- Unexpected end of file exception
Copyright (C) 1998 Free Software Foundation, Inc.
/* NotActiveException.java -- thrown when serialization is not active
Copyright (C) 1998, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -42,38 +42,31 @@ package java.io;
* This exception is thrown when a problem occurs due to the fact that
* serialization is not active.
*
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.1
* @status updated to 1.4
*/
public class NotActiveException extends ObjectStreamException
{
/*
* Constructors
/**
* Compatible with JDK 1.1+.
*/
private static final long serialVersionUID = -3893467273049808895L;
/**
* Create a new NotActiveException without a descriptive error message
/**
* Create an exception without a descriptive error message.
*/
public
NotActiveException()
{
super();
}
/*************************************************************************/
public NotActiveException()
{
}
/**
* Create a new NotActiveException with a descriptive error message String
/**
* Create an exception with a descriptive error message.
*
* @param message The descriptive error message
* @param message the descriptive error message
*/
public
NotActiveException(String message)
{
public NotActiveException(String message)
{
super(message);
}
}
} // class NotActiveException
/* NotSerializableException.java -- Unexpected end of file exception
Copyright (C) 1998 Free Software Foundation, Inc.
/* NotSerializableException.java -- a Serializable class that isn't
Copyright (C) 1998, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -39,42 +39,36 @@ exception statement from your version. */
package java.io;
/**
* This exception is thrown when a class may not be serialized. The
* descriptive message will consist of the name of the class in question.
*
* @version 0.0
* This exception is thrown when a class implements Serializable because
* of a superclass, but should not be serialized. The descriptive message
* will consist of the name of the class in question.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.1
* @status updated to 1.4
*/
public class NotSerializableException extends ObjectStreamException
{
/*
* Constructors
/**
* Compatible with JDK 1.1+.
*/
private static final long serialVersionUID = 2906642554793891381L;
/**
* Create a new NotSerializableException without a descriptive error message
/**
* Create an exception without a descriptive error message.
*/
public
NotSerializableException()
{
super();
}
/*************************************************************************/
public NotSerializableException()
{
}
/**
* Create a new NotSerializableException with a descriptive error message String
* This should be the name of the class that cannot be serialized.
/**
* Create an exception with a descriptive error message, which should
* be the name of the class.
*
* @param message The descriptive error message
* @param message the descriptive error message
*/
public
NotSerializableException(String message)
{
public NotSerializableException(String message)
{
super(message);
}
}
} // class NotSerializableException
......@@ -54,18 +54,20 @@ public interface ObjectStreamConstants
final static short STREAM_MAGIC = (short)0xaced;
final static short STREAM_VERSION = 5;
final static byte TC_NULL = (byte)112;
final static byte TC_REFERENCE = (byte)113;
final static byte TC_CLASSDESC = (byte)114;
final static byte TC_OBJECT = (byte)115;
final static byte TC_STRING = (byte)116;
final static byte TC_ARRAY = (byte)117;
final static byte TC_CLASS = (byte)118;
final static byte TC_BLOCKDATA = (byte)119;
final static byte TC_ENDBLOCKDATA = (byte)120;
final static byte TC_RESET = (byte)121;
final static byte TC_BLOCKDATALONG = (byte)122;
final static byte TC_EXCEPTION = (byte)123;
final static byte TC_NULL = (byte)112; //0x70
final static byte TC_REFERENCE = (byte)113; //0x71
final static byte TC_CLASSDESC = (byte)114; //0x72
final static byte TC_OBJECT = (byte)115; //0x73
final static byte TC_STRING = (byte)116; //0x74
final static byte TC_ARRAY = (byte)117; //0x75
final static byte TC_CLASS = (byte)118; //0x76
final static byte TC_BLOCKDATA = (byte)119; //0x77
final static byte TC_ENDBLOCKDATA = (byte)120; //0x78
final static byte TC_RESET = (byte)121; //0x79
final static byte TC_BLOCKDATALONG = (byte)122; //0x7A
final static byte TC_EXCEPTION = (byte)123; //0x7B
final static byte TC_LONGSTRING = (byte)124; //0x7C
final static byte TC_PROXYCLASSDESC = (byte)125; //0x7D
final static byte TC_BASE = TC_NULL;
final static byte TC_MAX = TC_EXCEPTION;
......
/* ObjectStreamException.java -- Superclass of all serialisation exceptions
Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
/* ObjectStreamException.java -- Superclass of all serialization exceptions
Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -38,49 +38,37 @@ exception statement from your version. */
package java.io;
/* Written using on-line Java Platform 1.2 API Specification.
* Status: Believed complete and correct.
*/
/**
* This exception is thrown when a problem occurs during serialization.
* There are more specific subclasses than give more fine grained
* indications of the precise failure.
*
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Warren Levy <warrenl@cygnus.com>
* @date February 7, 2000.
* @since 1.1
* @status updated to 1.4
*/
public abstract class ObjectStreamException extends IOException
{
/*
* Constructors
/**
* Compatible with JDK 1.1+.
*/
private static final long serialVersionUID = 7260898174833392607L;
/**
* Create a new ObjectStreamException without a descriptive error message
/**
* Create an exception without a descriptive error message.
*/
protected
ObjectStreamException()
{
super();
}
protected ObjectStreamException()
{
}
/*************************************************************************/
/**
* Create a new ObjectStreamException with a descriptive error message String
/**
* Create an exception with a descriptive error message.
*
* @param message The descriptive error message
* @param message the descriptive error message
*/
protected
ObjectStreamException(String message)
{
protected ObjectStreamException(String message)
{
super(message);
}
}
} // class ObjectStreamException
/* OptionalDataException.java -- indicates unexpected data in serialised stream
Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
/* OptionalDataException.java -- indicates unexpected data in serialized stream
Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -38,61 +38,54 @@ exception statement from your version. */
package java.io;
/* Written using on-line Java Platform 1.2 API Specification.
* Status: Believed complete and correct.
*/
/**
* This exception is thrown when unexpected data appears in the input
* stream from which a serialized object is being read. The field
* <code>eof</code> will always be set to true (***Why even have it?***) and
* the <code>count</code> field will contain the number of valid bytes
* available to be read.
*
* @version 0.0
* stream from which a serialized object is being read. There are two
* cases:<br><ul>
* <li>The next stream element is primitive data. <code>eof</code> will
* be false, and <code>count</code> is the number of bytes of primitive
* data available.</li>
* <li>The data consumable by readObject or readExternal has been exhausted.
* <code>eof</code> is true, and <code>count</code> is 0.</li>
* </ul>
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Warren Levy <warrenl@cygnus.com>
* @date February 7, 2000.
* @since 1.1
* @status updated to 1.4
*/
public class OptionalDataException extends ObjectStreamException
{
private static final long serialVersionUID = -8011121865681257820L;
/*
* Instance Variables
*/
/**
* Whether or not the end of the stream has been reached
/**
* Compatible with JDK 1.1+.
*/
public boolean eof;
private static final long serialVersionUID = -8011121865681257820L;
/**
* The number of valid bytes that can be read
/**
* Whether or not the end of the stream has been reached.
*
* @serial the end of the buffer was reached
*/
public int length;
public boolean eof;
/*************************************************************************/
/*
* Constructors
/**
* The number of valid bytes that can be read.
*
* @serial the bytes of the buffer remaining
*/
public int length;
/**
/**
* Create a new OptionalDataException with an eof parameter indicating
* whether or not the end of stream is reached and the number of valid
* bytes that may be read.
*
* @param eof 'true' if end of stream reached, 'false' otherwise
* @param count The number of valid bytes to be read.
* @param count The number of valid bytes to be read
*/
OptionalDataException(boolean eof, int count)
{
OptionalDataException(boolean eof, int count)
{
this.eof = eof;
this.length = count;
}
}
} // class OptionalDataException
......@@ -67,10 +67,15 @@ public class PipedInputStream extends InputStream
/** Set to true if close() has been called on this InputStream. */
boolean closed;
/**
* The size of the internal buffer used for input/output.
*/
protected static final int PIPE_SIZE = 2048;
/* The "Constant Field Values" Javadoc of the Sun J2SE 1.4
* specifies 1024.
*/
protected static final int PIPE_SIZE = 1024;
/**
* This is the internal circular buffer used for storing bytes written
......
......@@ -201,6 +201,7 @@ public class PushbackInputStream extends FilterInputStream
public synchronized int read(byte[] b, int off, int len) throws IOException
{
int numBytes = Math.min(buf.length - pos, len);
if (numBytes > 0)
{
System.arraycopy (buf, pos, b, off, numBytes);
......@@ -212,7 +213,7 @@ public class PushbackInputStream extends FilterInputStream
if (len > 0)
{
len = super.read(b, off, len);
if (len == -1) // EOF
if (len == -1) //EOF
return numBytes > 0 ? numBytes : -1;
numBytes += len;
}
......@@ -318,6 +319,7 @@ public class PushbackInputStream extends FilterInputStream
int numread = (int) Math.min((long) (buf.length - pos), n);
pos += numread;
n -= numread;
if (n > 0)
n -= super.skip(n);
}
......
/* StreamCorruptedException.java -- Error in stream during serialization
Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -38,48 +38,36 @@ exception statement from your version. */
package java.io;
/* Written using on-line Java Platform 1.2 API Specification.
* Status: Believed complete and correct.
*/
/**
* This exception is thrown when there is an error in the data that is
* read from a stream during de-serialization.
*
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Warren Levy <warrenl@cygnus.com>
* @date February 7, 2000.
* @since 1.1
* @status updated to 1.4
*/
public class StreamCorruptedException extends ObjectStreamException
{
/*
* Constructors
/**
* Compatible with JDK 1.1+.
*/
private static final long serialVersionUID = 8983558202217591746L;
/**
* Create a new StreamCorruptedException without a descriptive error message
/**
* Create an exception without a descriptive error message.
*/
public
StreamCorruptedException()
{
super();
}
public StreamCorruptedException()
{
}
/*************************************************************************/
/**
* Create a new StreamCorruptedException with a descriptive error message String
/**
* Create an exception with a descriptive error message.
*
* @param message The descriptive error message
* @param message the descriptive error message
*/
public
StreamCorruptedException(String message)
{
public StreamCorruptedException(String message)
{
super(message);
}
}
} // class StreamCorruptedException
/* SyncFailedException.java -- The sync failed (?)
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
/* SyncFailedException.java -- a file sync failed
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -38,49 +38,29 @@ exception statement from your version. */
package java.io;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
* Status: Complete to 1.1.
*/
/**
* I really wish I knew what caused this exception to be thrown.
*
* @version 0.0
* Thrown when a file synchronization fails.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@cygnus.com>
* @date September 24, 1998
* @see FileDescriptor#sync()
* @since 1.1
* @status updated to 1.4
*/
public class SyncFailedException extends IOException
{
private static final long serialVersionUID = -2353342684412443330L;
/*
* Constructors
*/
/**
* Create a new SyncFailedException without a descriptive error message
/**
* Compatible with JDK 1.1+.
*/
SyncFailedException()
{
super();
}
private static final long serialVersionUID = -2353342684412443330L;
/*************************************************************************/
/**
* Create a new SyncFailedException with a descriptive error message String
/**
* Create an exception with a descriptive error message.
*
* @param message The descriptive error message
* @param message the descriptive error message
*/
public
SyncFailedException(String message)
{
public SyncFailedException(String message)
{
super(message);
}
}
} // class SyncFailedException
/* UTFDataFormatException.java -- Bad format in UTF data
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
/* UTFDataFormatException.java -- thrown on bad format in UTF data
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -38,49 +38,37 @@ exception statement from your version. */
package java.io;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
* Status: Complete to 1.1.
*/
/**
* When reading a UTF string from an input stream, this exception is thrown
* to indicate that the data read is invalid.
*
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@cygnus.com>
* @date September 24, 1998
* @see DataInput
* @see DataInputStream#readUTF(DataInput)
* @status updated to 1.4
*/
public class UTFDataFormatException extends IOException
{
/*
* Constructors
/**
* Compatible with JDK 1.0+.
*/
private static final long serialVersionUID = 420743449228280612L;
/**
* Create a new UTFDataFormatException without a descriptive error message
/**
* Create a new UTFDataFormatException without a descriptive error message.
*/
public
UTFDataFormatException()
{
super();
}
public UTFDataFormatException()
{
}
/*************************************************************************/
/**
* Create a new UTFDataFormatException with a descriptive error message String
/**
* Create a new UTFDataFormatException with a descriptive error message.
*
* @param message The descriptive error message
* @param message the descriptive error message
*/
public
UTFDataFormatException(String message)
{
public UTFDataFormatException(String message)
{
super(message);
}
}
} // class UTFDataFormatException
/* UnsupportedEncodingException.java -- The requested encoding isn't supported
Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
/* UnsupportedEncodingException.java -- the requested encoding isn't supported
Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -38,49 +38,36 @@ exception statement from your version. */
package java.io;
/* Written using "Java Class Libraries", 2nd edition, plus online
* API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct.
*/
/**
* This exception is thrown when the requested character encoding is
* not supported.
*
* @version 0.0
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Per Bothner <bothner@cygnus.com>
* @date April 17, 1998.
* @since 1.1
* @status updated to 1.4
*/
public class UnsupportedEncodingException extends IOException
{
/*
* Constructors
/**
* Compatible with JDK 1.1+.
*/
private static final long serialVersionUID = -4274276298326136670L;
/**
* Create a new UnsupportedEncodingException without a descriptive error message
/**
* Create an exception without a descriptive error message.
*/
public
UnsupportedEncodingException()
{
super();
}
public UnsupportedEncodingException()
{
}
/*************************************************************************/
/**
* Create a new UnsupportedEncodingException with a descriptive error message String
/**
* Create an exception with a descriptive error message.
*
* @param message The descriptive error message
* @param message the descriptive error message
*/
public
UnsupportedEncodingException(String message)
{
public UnsupportedEncodingException(String message)
{
super(message);
}
}
} // class UnsupportedEncodingException
/* WriteAbortedException.java -- An exception occurred while writing a
serialization stream
Copyright (C) 1998, 2000 Free Software Foundation, Inc.
/* WriteAbortedException.java -- wraps an exception thrown while writing
Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
......@@ -40,61 +39,71 @@ exception statement from your version. */
package java.io;
/**
* This exception is thrown when one of the other ObjectStreamException
* subclasses was thrown during a serialization write.
*
* @version 0.0
* This exception is thrown when another ObjectStreamException occurs during
* a serialization read or write. The stream is reset, and deserialized
* objects are discarded.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Eric Blake <ebb9@email.byu.edu>
* @since 1.1
* @status updated to 1.4
*/
public class WriteAbortedException extends ObjectStreamException
{
/*
* Instance Variables
*/
/**
* The detailed exception that caused this exception to be thrown
/**
* Compatible with JDK 1.1+.
*/
public Exception detail;
private transient String message;
private static final long serialVersionUID = -3326426625597282442L;
/*************************************************************************/
/*
* Constructors
/**
* The cause of this exception. This pre-dates the exception chaining
* of Throwable; and although you can change this field, you are wiser
* to leave it alone.
*
* @serial the exception cause
*/
public Exception detail;
/**
* Create a new WriteAbortedException with an eof parameter indicating
* the detailed Exception that caused this exception to be thrown.
/**
* Create a new WriteAbortedException with a specified message and
* cause.
*
* @param detail The exception that caused this exception to be thrown
* @param msg the message
* @param detail the cause
*/
public
WriteAbortedException(String msg, Exception detail)
{
this.message = msg;
public WriteAbortedException(String msg, Exception detail)
{
super(msg);
initCause(detail);
this.detail = detail;
}
}
/*************************************************************************/
/*
* Instance Variables
/**
* This method returns a message indicating what went wrong, in this
* format:
* <code>super.getMessage() + (detail == null ? "" : "; " + detail)<code>.
*
* @return the chained message
*/
/**
* This method returns a message indicating what went wrong, including
* the message text from the initial exception that caused this one to
* be thrown
public String getMessage()
{
if (detail == this || detail == null)
return super.getMessage();
return super.getMessage() + "; " + detail;
}
/**
* Returns the cause of this exception. Note that this may not be the
* original cause, thanks to the <code>detail</code> field being public
* and non-final (yuck). However, to avoid violating the contract of
* Throwable.getCause(), this returns null if <code>detail == this</code>,
* as no exception can be its own cause.
*
* @return the cause
* @since 1.4
*/
public String
getMessage()
{
return(message + ": " + detail.getMessage());
}
public Throwable getCause()
{
return detail == this ? null : detail;
}
} // class WriteAbortedException
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment