1 |
/* OptionalDataException.java -- indicates unexpected data in serialised stream |
/* OptionalDataException.java -- indicates unexpected data in serialized stream |
2 |
Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc. |
Copyright (C) 1998, 2000, 2001, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
7 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
8 |
the Free Software Foundation; either version 2, or (at your option) |
the Free Software Foundation; either version 2, or (at your option) |
9 |
any later version. |
any later version. |
10 |
|
|
11 |
GNU Classpath is distributed in the hope that it will be useful, but |
GNU Classpath is distributed in the hope that it will be useful, but |
12 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
38 |
|
|
39 |
package java.io; |
package java.io; |
40 |
|
|
|
/* Written using on-line Java Platform 1.2 API Specification. |
|
|
* Status: Believed complete and correct. |
|
|
*/ |
|
|
|
|
41 |
/** |
/** |
42 |
* This exception is thrown when unexpected data appears in the input |
* This exception is thrown when unexpected data appears in the input |
43 |
* stream from which a serialized object is being read. The field |
* stream from which a serialized object is being read. There are two |
44 |
* <code>eof</code> will always be set to true (***Why even have it?***) and |
* cases:<br><ul> |
45 |
* the <code>count</code> field will contain the number of valid bytes |
* <li>The next stream element is primitive data. <code>eof</code> will |
46 |
* available to be read. |
* be false, and <code>count</code> is the number of bytes of primitive |
47 |
* |
* data available.</li> |
48 |
* @version 0.0 |
* <li>The data consumable by readObject or readExternal has been exhausted. |
49 |
* |
* <code>eof</code> is true, and <code>count</code> is 0.</li> |
50 |
* @author Aaron M. Renn (arenn@urbanophile.com) |
* </ul> |
51 |
* @author Warren Levy <warrenl@cygnus.com> |
* |
52 |
* @date February 7, 2000. |
* @author Aaron M. Renn (arenn@urbanophile.com) |
53 |
*/ |
* @author Warren Levy <warrenl@cygnus.com> |
54 |
public class OptionalDataException extends ObjectStreamException |
* @since 1.1 |
55 |
{ |
* @status updated to 1.4 |
|
|
|
|
private static final long serialVersionUID = -8011121865681257820L; |
|
|
|
|
|
/* |
|
|
* Instance Variables |
|
56 |
*/ |
*/ |
57 |
|
public class OptionalDataException extends ObjectStreamException |
|
/** |
|
|
* 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) |
|
58 |
{ |
{ |
59 |
this.eof = eof; |
/** |
60 |
this.length = count; |
* Compatible with JDK 1.1+. |
61 |
} |
*/ |
62 |
|
private static final long serialVersionUID = -8011121865681257820L; |
63 |
|
|
64 |
|
/** |
65 |
|
* Whether or not the end of the stream has been reached. |
66 |
|
* |
67 |
|
* @serial the end of the buffer was reached |
68 |
|
*/ |
69 |
|
public boolean eof; |
70 |
|
|
71 |
|
/** |
72 |
|
* The number of valid bytes that can be read. |
73 |
|
* |
74 |
|
* @serial the bytes of the buffer remaining |
75 |
|
*/ |
76 |
|
public int length; |
77 |
|
|
78 |
|
/** |
79 |
|
* Create a new OptionalDataException with an eof parameter indicating |
80 |
|
* whether or not the end of stream is reached and the number of valid |
81 |
|
* bytes that may be read. |
82 |
|
* |
83 |
|
* @param eof 'true' if end of stream reached, 'false' otherwise |
84 |
|
* @param count The number of valid bytes to be read |
85 |
|
*/ |
86 |
|
OptionalDataException(boolean eof, int count) |
87 |
|
{ |
88 |
|
this.eof = eof; |
89 |
|
this.length = count; |
90 |
|
} |
91 |
} // class OptionalDataException |
} // class OptionalDataException |
|
|
|