* 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
+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.
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.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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
- */
-public class CharConversionException extends IOException
-{
-
-/*
- * Constructors
+ * This exception is thrown to indicate that a problem occurred with
+ * an attempted character conversion.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey <tromey@cygnus.com>
+ * @since 1.1
+ * @status updated to 1.4
*/
-
-/**
- * Create a new CharConversionException without a descriptive error message
- */
-public
-CharConversionException()
+public class CharConversionException extends IOException
{
- super();
-}
-
-/*************************************************************************/
+ /**
+ * Compatible with JDK 1.1+.
+ */
+ private static final long serialVersionUID = -8680016352018427031L;
-/**
- * Create a new CharConversionException with a descriptive error message String
- *
- * @param message The descriptive error message
- */
-public
-CharConversionException(String message)
-{
- super(message);
-}
+ /**
+ * Create an exception without a descriptive error message.
+ */
+ public CharConversionException()
+ {
+ }
+ /**
+ * Create an exception with a descriptive error message.
+ *
+ * @param message the descriptive error 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.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
- * @date September 24, 1998
- */
-public class EOFException extends IOException
-{
-
-/*
- * Constructors
+ * This exception is thrown when the end of the file or stream was
+ * 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>
+ * @status updated to 1.4
*/
-
-/**
- * Create a new EOFException without a descriptive error message
- */
-public
-EOFException()
+public class EOFException extends IOException
{
- super();
-}
-
-/*************************************************************************/
+ /**
+ * Compatible with JDK 1.0+.
+ */
+ private static final long serialVersionUID = 6433858223774886977L;
-/**
- * Create a new EOFException with a descriptive error message String
- *
- * @param message The descriptive error message
- */
-public
-EOFException(String message)
-{
- super(message);
-}
+ /**
+ * Create an exception without a descriptive error message.
+ */
+ public EOFException()
+ {
+ }
+ /**
+ * Create an exception with a descriptive error message.
+ *
+ * @param message the descriptive error 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.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
- * @date September 24, 1998
- */
-public class FileNotFoundException extends IOException
-{
-
-/*
- * Constructors
+ * This exception is thrown when an attempt is made to access a file that
+ * 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 Tom Tromey <tromey@cygnus.com>
+ * @status updated to 1.4
*/
-
-/**
- * Create a new FileNotFoundException without a descriptive error message
- */
-public
-FileNotFoundException()
+public class FileNotFoundException extends IOException
{
- super();
-}
-
-/*************************************************************************/
+ /**
+ * Compatible with JDK 1.0+.
+ */
+ private static final long serialVersionUID = -897856973823710492L;
-/**
- * Create a new FileNotFoundException with a descriptive error message String
- *
- * @param message The descriptive error message
- */
-public
-FileNotFoundException(String message)
-{
- super(message);
-}
+ /**
+ * Create an exception without a descriptive error message.
+ */
+ public FileNotFoundException()
+ {
+ }
+ /**
+ * Create an exception with a descriptive error message.
+ *
+ * @param message the descriptive error 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.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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
{
+ /**
+ * Compatible with JDK 1.0+.
+ */
+ private static final long serialVersionUID = 7818375828146090155L;
-/*
- * Constructors
- */
-
-/**
- * Create a new IOException without a descriptive error message
- */
-public
-IOException()
-{
- super();
-}
-
-/*************************************************************************/
-
-/**
- * Create a new IOException with a descriptive error message String
- *
- * @param message The descriptive error message
- */
-public
-IOException(String message)
-{
- super(message);
-}
+ /**
+ * Create an exception without a descriptive error message.
+ */
+ public IOException()
+ {
+ }
+ /**
+ * Create an exception with a descriptive error message.
+ *
+ * @param message the descriptive error 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.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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.
+ * 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
- *
- * @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
- */
-
-/**
- * The number of bytes read/written prior to the interruption
- */
-public int bytesTransferred;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Create a new InterruptedIOException without a descriptive error message
- */
-public
-InterruptedIOException()
-{
- super();
-}
-
-/*************************************************************************/
-
-/**
- * Create a new InterruptedIOException with a descriptive error message String
- *
- * @param message The descriptive error 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.
- *
- * @param message The descriptive error message
- * @param bytesTransferred The number of bytes tranferred before the interruption
- */
-InterruptedIOException(String message, int bytesTransferred)
-{
- super(message);
- this.bytesTransferred = bytesTransferred;
-}
-
+ /**
+ * Compatible with JDK 1.0+.
+ */
+ private static final long serialVersionUID = 4020568460727500567L;
+
+ /**
+ * The number of bytes read/written prior to the interruption.
+ *
+ * @serial count of bytes successfully transferred
+ */
+ public int bytesTransferred;
+
+ /**
+ * Create an extends without a descriptive error message.
+ */
+ public InterruptedIOException()
+ {
+ }
+
+ /**
+ * Create an exception with a descriptive error message.
+ *
+ * @param message the descriptive error message
+ */
+ public InterruptedIOException(String message)
+ {
+ super(message);
+ }
+
+ /**
+ * Create an exception with a descriptive error message and count of
+ * bytes transferred.
+ *
+ * @param message the descriptive error message
+ * @param bytesTransferred number of bytes tranferred before interruption
+ */
+ 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.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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 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)
- */
+ * This exception is thrown when there is some sort of problem with a
+ * 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.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @since 1.1
+ * @status updated to 1.4
+ */
public class InvalidClassException extends ObjectStreamException
{
/**
- * The name of the class which encountered the error.
- */
+ * 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
- *
- * @param message The descriptive error message
- */
+ * Create an exception with a descriptive error message, but a null
+ * classname.
+ *
+ * @param message the descriptive error message
+ */
public InvalidClassException(String message)
{
super(message);
}
/**
- * Create a new InvalidClassException with a descriptive error message
- * String, 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
- */
+ * Create an exception with a descriptive error message, and the name of
+ * the class that caused the problem.
+ *
+ * @param classname the name of the faulty class
+ * @param message the descriptive error message
+ */
public InvalidClassException(String classname, String message)
{
super(message);
}
/**
- * 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()
- *
- * @return A descriptive error message
- */
+ * Returns the descriptive error message for this exception. It will
+ * include the class name that caused the problem if known, in the format:
+ * <code>[classname][; ][super.getMessage()]</code>.
+ *
+ * @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.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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)
- */
-public class InvalidObjectException extends ObjectStreamException
-{
-
-/*
- * Constructors
+ * This exception is thrown when an object fails a validation test
+ * during serialization.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @since 1.1
+ * @status updated to 1.4
*/
-
-/**
- * Create a new InvalidObjectException with a descriptive error message String
- *
- * @param message The descriptive error message
- */
-public
-InvalidObjectException(String message)
+public class InvalidObjectException extends ObjectStreamException
{
- super(message);
-}
+ /**
+ * Compatible with JDK 1.1+.
+ */
+ private static final long serialVersionUID = 3233174318281839583L;
+ /**
+ * Create an exception with a descriptive error message String. This should
+ * be the cause of the verification failure.
+ *
+ * @param message the descriptive error 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.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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)
- */
-public class NotActiveException extends ObjectStreamException
-{
-
-/*
- * Constructors
+ * This exception is thrown when a problem occurs due to the fact that
+ * serialization is not active.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @since 1.1
+ * @status updated to 1.4
*/
-
-/**
- * Create a new NotActiveException without a descriptive error message
- */
-public
-NotActiveException()
+public class NotActiveException extends ObjectStreamException
{
- super();
-}
+ /**
+ * Compatible with JDK 1.1+.
+ */
+ private static final long serialVersionUID = -3893467273049808895L;
-/*************************************************************************/
-
-/**
- * Create a new NotActiveException with a descriptive error message String
- *
- * @param message The descriptive error message
- */
-public
-NotActiveException(String message)
-{
- super(message);
-}
+ /**
+ * Create an exception without a descriptive error message.
+ */
+ public NotActiveException()
+ {
+ }
+ /**
+ * Create an exception with a descriptive error message.
+ *
+ * @param message the descriptive error 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.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class NotSerializableException extends ObjectStreamException
-{
-
-/*
- * Constructors
+ * 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
*/
-
-/**
- * Create a new NotSerializableException without a descriptive error message
- */
-public
-NotSerializableException()
+public class NotSerializableException extends ObjectStreamException
{
- super();
-}
+ /**
+ * Compatible with JDK 1.1+.
+ */
+ private static final long serialVersionUID = 2906642554793891381L;
-/*************************************************************************/
-
-/**
- * Create a new NotSerializableException with a descriptive error message String
- * This should be the name of the class that cannot be serialized.
- *
- * @param message The descriptive error message
- */
-public
-NotSerializableException(String message)
-{
- super(message);
-}
+ /**
+ * Create an exception without a descriptive error message.
+ */
+ public NotSerializableException()
+ {
+ }
+ /**
+ * Create an exception with a descriptive error message, which should
+ * be the name of the class.
+ *
+ * @param message the descriptive error message
+ */
+ public NotSerializableException(String message)
+ {
+ super(message);
+ }
} // class NotSerializableException
-
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.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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.
- */
-public abstract class ObjectStreamException extends IOException
-{
-
-/*
- * Constructors
+ * 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.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy <warrenl@cygnus.com>
+ * @since 1.1
+ * @status updated to 1.4
*/
-
-/**
- * Create a new ObjectStreamException without a descriptive error message
- */
-protected
-ObjectStreamException()
+public abstract class ObjectStreamException extends IOException
{
- super();
-}
+ /**
+ * Compatible with JDK 1.1+.
+ */
+ private static final long serialVersionUID = 7260898174833392607L;
-/*************************************************************************/
-
-/**
- * Create a new ObjectStreamException with a descriptive error message String
- *
- * @param message The descriptive error message
- */
-protected
-ObjectStreamException(String message)
-{
- super(message);
-}
+ /**
+ * Create an exception without a descriptive error message.
+ */
+ protected ObjectStreamException()
+ {
+ }
+ /**
+ * Create an exception with a descriptive error message.
+ *
+ * @param message the descriptive error 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.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
- * @date February 7, 2000.
- */
-public class OptionalDataException extends ObjectStreamException
-{
-
-private static final long serialVersionUID = -8011121865681257820L;
-
-/*
- * Instance Variables
+ * This exception is thrown when unexpected data appears in the input
+ * 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>
+ * @since 1.1
+ * @status updated to 1.4
*/
-
-/**
- * Whether or not the end of the stream has been reached
- */
-public boolean eof;
-
-/**
- * The number of valid bytes that can be read
- */
-public int length;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * 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.
- */
-OptionalDataException(boolean eof, int count)
+public class OptionalDataException extends ObjectStreamException
{
- this.eof = eof;
- this.length = count;
-}
-
+ /**
+ * Compatible with JDK 1.1+.
+ */
+ private static final long serialVersionUID = -8011121865681257820L;
+
+ /**
+ * Whether or not the end of the stream has been reached.
+ *
+ * @serial the end of the buffer was reached
+ */
+ public boolean eof;
+
+ /**
+ * 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
+ */
+ OptionalDataException(boolean eof, int count)
+ {
+ this.eof = eof;
+ this.length = count;
+ }
} // class OptionalDataException
-
/** 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 size of the internal buffer used for input/output.
+ */
+ /* 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
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);
off += numBytes;
}
- if (len > 0)
+ if (len > 0)
{
len = super.read(b, off, len);
- if (len == -1) // EOF
+ if (len == -1) //EOF
return numBytes > 0 ? numBytes : -1;
numBytes += len;
}
int numread = (int) Math.min((long) (buf.length - pos), n);
pos += numread;
n -= numread;
- n -= super.skip(n);
+ if (n > 0)
+ n -= super.skip(n);
}
return origN - 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.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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.
- */
-public class StreamCorruptedException extends ObjectStreamException
-{
-
-/*
- * Constructors
+ * This exception is thrown when there is an error in the data that is
+ * read from a stream during de-serialization.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy <warrenl@cygnus.com>
+ * @since 1.1
+ * @status updated to 1.4
*/
-
-/**
- * Create a new StreamCorruptedException without a descriptive error message
- */
-public
-StreamCorruptedException()
+public class StreamCorruptedException extends ObjectStreamException
{
- super();
-}
-
-/*************************************************************************/
+ /**
+ * Compatible with JDK 1.1+.
+ */
+ private static final long serialVersionUID = 8983558202217591746L;
-/**
- * Create a new StreamCorruptedException with a descriptive error message String
- *
- * @param message The descriptive error message
- */
-public
-StreamCorruptedException(String message)
-{
- super(message);
-}
+ /**
+ * Create an exception without a descriptive error message.
+ */
+ public StreamCorruptedException()
+ {
+ }
+ /**
+ * Create an exception with a descriptive error message.
+ *
+ * @param message the descriptive error 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.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey <tromey@cygnus.com>
- * @date September 24, 1998
- */
-public class SyncFailedException extends IOException
-{
-
-private static final long serialVersionUID = -2353342684412443330L;
-
-/*
- * Constructors
+ * Thrown when a file synchronization fails.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey <tromey@cygnus.com>
+ * @see FileDescriptor#sync()
+ * @since 1.1
+ * @status updated to 1.4
*/
-
-/**
- * Create a new SyncFailedException without a descriptive error message
- */
-SyncFailedException()
-{
- super();
-}
-
-/*************************************************************************/
-
-/**
- * Create a new SyncFailedException with a descriptive error message String
- *
- * @param message The descriptive error message
- */
-public
-SyncFailedException(String message)
+public class SyncFailedException extends IOException
{
- super(message);
-}
-
+ /**
+ * Compatible with JDK 1.1+.
+ */
+ private static final long serialVersionUID = -2353342684412443330L;
+
+ /**
+ * Create an exception with a descriptive error message.
+ *
+ * @param message the descriptive error 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.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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
- */
-public class UTFDataFormatException extends IOException
-{
-
-/*
- * Constructors
+ * When reading a UTF string from an input stream, this exception is thrown
+ * to indicate that the data read is invalid.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Tom Tromey <tromey@cygnus.com>
+ * @see DataInput
+ * @see DataInputStream#readUTF(DataInput)
+ * @status updated to 1.4
*/
-
-/**
- * Create a new UTFDataFormatException without a descriptive error message
- */
-public
-UTFDataFormatException()
+public class UTFDataFormatException extends IOException
{
- super();
-}
-
-/*************************************************************************/
+ /**
+ * Compatible with JDK 1.0+.
+ */
+ private static final long serialVersionUID = 420743449228280612L;
-/**
- * Create a new UTFDataFormatException with a descriptive error message String
- *
- * @param message The descriptive error message
- */
-public
-UTFDataFormatException(String message)
-{
- super(message);
-}
+ /**
+ * Create a new UTFDataFormatException without a descriptive error message.
+ */
+ public UTFDataFormatException()
+ {
+ }
+ /**
+ * Create a new UTFDataFormatException with a descriptive error message.
+ *
+ * @param message the descriptive error 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.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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.
- */
-public class UnsupportedEncodingException extends IOException
-{
-
-/*
- * Constructors
+ * This exception is thrown when the requested character encoding is
+ * not supported.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Per Bothner <bothner@cygnus.com>
+ * @since 1.1
+ * @status updated to 1.4
*/
-
-/**
- * Create a new UnsupportedEncodingException without a descriptive error message
- */
-public
-UnsupportedEncodingException()
+public class UnsupportedEncodingException extends IOException
{
- super();
-}
-
-/*************************************************************************/
+ /**
+ * Compatible with JDK 1.1+.
+ */
+ private static final long serialVersionUID = -4274276298326136670L;
-/**
- * Create a new UnsupportedEncodingException with a descriptive error message String
- *
- * @param message The descriptive error message
- */
-public
-UnsupportedEncodingException(String message)
-{
- super(message);
-}
+ /**
+ * Create an exception without a descriptive error message.
+ */
+ public UnsupportedEncodingException()
+ {
+ }
+ /**
+ * Create an exception with a descriptive error message.
+ *
+ * @param message the descriptive error 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.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
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
- */
-public Exception detail;
-private transient String message;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Create a new WriteAbortedException with an eof parameter indicating
- * the detailed Exception that caused this exception to be thrown.
- *
- * @param detail The exception that caused this exception to be thrown
- */
-public
-WriteAbortedException(String msg, Exception detail)
-{
- this.message = msg;
- this.detail = detail;
-}
-
-/*************************************************************************/
-
-/*
- * Instance Variables
- */
-
-/**
- * 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()
-{
- return(message + ": " + detail.getMessage());
-}
-
+ /**
+ * Compatible with JDK 1.1+.
+ */
+ private static final long serialVersionUID = -3326426625597282442L;
+
+ /**
+ * 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 a specified message and
+ * cause.
+ *
+ * @param msg the message
+ * @param detail the cause
+ */
+ public WriteAbortedException(String msg, Exception detail)
+ {
+ super(msg);
+ initCause(detail);
+ this.detail = detail;
+ }
+
+ /**
+ * This method returns a message indicating what went wrong, in this
+ * format:
+ * <code>super.getMessage() + (detail == null ? "" : "; " + detail)<code>.
+ *
+ * @return the chained message
+ */
+ 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 Throwable getCause()
+ {
+ return detail == this ? null : detail;
+ }
} // class WriteAbortedException
-