1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package java.io; 19 20 /** 21 * Signals that the {@link ObjectInputStream} class encountered a primitive type 22 * ({@code int}, {@code char} etc.) instead of an object instance in the input 23 * stream. 24 * 25 * @see ObjectInputStream#available() 26 * @see ObjectInputStream#readObject() 27 * @see ObjectInputStream#skipBytes(int) 28 */ 29 public class OptionalDataException extends ObjectStreamException { 30 31 private static final long serialVersionUID = -8011121865681257820L; 32 33 /** 34 * {@code true} indicates that there is no more primitive data available. 35 */ 36 public boolean eof; 37 38 /** 39 * The number of bytes of primitive data (int, char, long etc.) that are 40 * available. 41 */ 42 public int length; 43 44 /** 45 * Constructs a new {@code OptionalDataException} with its stack trace 46 * filled in. 47 */ 48 OptionalDataException() { 49 } 50 51 /** 52 * Constructs a new {@code OptionalDataException} with its stack trace and 53 * detail message filled in. 54 * 55 * @param detailMessage 56 * the detail message for this exception. 57 */ 58 OptionalDataException(String detailMessage) { 59 super(detailMessage); 60 } 61 } 62