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