< prev index next >

src/java.base/share/classes/java/io/ObjectInputStream.java

Print this page




1304      * @throws IllegalArgumentException if arrayType isn't actually an array type
1305      * @throws NegativeArraySizeException if arrayLength is negative
1306      * @throws InvalidClassException if the filter rejects creation
1307      */
1308     private void checkArray(Class<?> arrayType, int arrayLength) throws InvalidClassException {
1309         if (! arrayType.isArray()) {
1310             throw new IllegalArgumentException("not an array type");
1311         }
1312 
1313         if (arrayLength < 0) {
1314             throw new NegativeArraySizeException();
1315         }
1316 
1317         filterCheck(arrayType, arrayLength);
1318     }
1319 
1320     /**
1321      * Provide access to the persistent fields read from the input stream.
1322      */
1323     public abstract static class GetField {




1324 
1325         /**
1326          * Get the ObjectStreamClass that describes the fields in the stream.
1327          *
1328          * @return  the descriptor class that describes the serializable fields
1329          */
1330         public abstract ObjectStreamClass getObjectStreamClass();
1331 
1332         /**
1333          * Return true if the named field is defaulted and has no value in this
1334          * stream.
1335          *
1336          * @param  name the name of the field
1337          * @return true, if and only if the named field is defaulted
1338          * @throws IOException if there are I/O errors while reading from
1339          *         the underlying <code>InputStream</code>
1340          * @throws IllegalArgumentException if <code>name</code> does not
1341          *         correspond to a serializable field
1342          */
1343         public abstract boolean defaulted(String name) throws IOException;




1304      * @throws IllegalArgumentException if arrayType isn't actually an array type
1305      * @throws NegativeArraySizeException if arrayLength is negative
1306      * @throws InvalidClassException if the filter rejects creation
1307      */
1308     private void checkArray(Class<?> arrayType, int arrayLength) throws InvalidClassException {
1309         if (! arrayType.isArray()) {
1310             throw new IllegalArgumentException("not an array type");
1311         }
1312 
1313         if (arrayLength < 0) {
1314             throw new NegativeArraySizeException();
1315         }
1316 
1317         filterCheck(arrayType, arrayLength);
1318     }
1319 
1320     /**
1321      * Provide access to the persistent fields read from the input stream.
1322      */
1323     public abstract static class GetField {
1324         /**
1325          * Constructor for subclasses to call.
1326          */
1327         public GetField() {}
1328 
1329         /**
1330          * Get the ObjectStreamClass that describes the fields in the stream.
1331          *
1332          * @return  the descriptor class that describes the serializable fields
1333          */
1334         public abstract ObjectStreamClass getObjectStreamClass();
1335 
1336         /**
1337          * Return true if the named field is defaulted and has no value in this
1338          * stream.
1339          *
1340          * @param  name the name of the field
1341          * @return true, if and only if the named field is defaulted
1342          * @throws IOException if there are I/O errors while reading from
1343          *         the underlying <code>InputStream</code>
1344          * @throws IllegalArgumentException if <code>name</code> does not
1345          *         correspond to a serializable field
1346          */
1347         public abstract boolean defaulted(String name) throws IOException;


< prev index next >