优惠码 第17页

鸿蒙OS StreamCorruptedException

StreamCorruptedException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.io.IOException |—|—|—|—java.io.ObjectStreamException |—|—|—|—|—java.io.StreamCorruptedException public class StreamCorruptedException extends ObjectStreamException 当从对象流中读取的控制信息违反内部一致性检查时抛出。 Since: JDK1.1 构造函数摘要 构造函数 描述 StreamCorruptedException() 创建一个 StreamCorruptedException 并列出抛出的原因。 StreamCorruptedException(String reason) 创建一个 StreamCorruptedException 并列出抛出的原因。 方法总结 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 从类 java.lang.Throwable 继承的方法 addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString 构造函数详细信息 StreamCorruptedException public StreamCorruptedException(String reason) 创建一个 StreamCorruptedException 并列出抛出的原因。 参数: 参数名称 参数描述 reason 描述异常原因的字符串。 StreamCorruptedException public StreamCorruptedException() 创建一个 StreamCorruptedException 并列出抛出的原因。

鸿蒙OS OptionalDataException

OptionalDataException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.io.IOException |—|—|—|—java.io.ObjectStreamException |—|—|—|—|—java.io.OptionalDataException public class OptionalDataException extends ObjectStreamException 异常指示由于未读取的原始数据或流中属于序列化对象的数据结束而导致对象读取操作失败。 在两种情况下可能会抛出此异常: 当流中的下一个元素是原始数据时,尝试读取对象。 在这种情况下,OptionalDataException 的长度字段设置为可立即从流中读取的原始数据的字节数,并且 eof 字段设置为 false。 试图通过类定义的 readObject 或 readExternal 方法读取数据的末尾。 在这种情况下,OptionalDataException 的 eof 字段设置为 true,长度字段设置为 0。 Since: JDK1.1 字段摘要 修饰符和类型 字段 描述 boolean eof 如果流的缓冲部分中没有更多数据,则为 true。 int length 当前缓冲区中可读取的原始数据的字节数。 方法总结 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 从类 java.lang.Throwable 继承的方法 addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString 字段详细信息 eof public boolean eof 如果流的缓冲部分中没有更多数据,则为 true。 length public int length 当前缓冲区中可读取的原始数据的字节数。

鸿蒙OS ObjectStreamException

ObjectStreamException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.io.IOException |—|—|—|—java.io.ObjectStreamException public abstract class ObjectStreamException extends IOException 特定于对象流类的所有异常的超类。 Since: JDK1.1 构造函数摘要 修饰符 构造函数 描述 protected ObjectStreamException() 创建一个 ObjectStreamException。 protected ObjectStreamException(String classname) 使用指定的参数创建 ObjectStreamException。 方法总结 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 从类 java.lang.Throwable 继承的方法 addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString 构造函数详细信息 ObjectStreamException protected ObjectStreamException(String classname) 使用指定的参数创建 ObjectStreamException。 参数: 参数名称 参数描述 classname 异常的详细信息 ObjectStreamException protected ObjectStreamException() 创建一个 ObjectStreamException。

鸿蒙OS NotSerializableException

NotSerializableException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.io.IOException |—|—|—|—java.io.ObjectStreamException |—|—|—|—|—java.io.NotSerializableException public class NotSerializableException extends ObjectStreamException 当实例需要具有 Serializable 接口时抛出。 序列化运行时或实例的类可以抛出此异常。 参数应该是类的名称。 Since: JDK1.1 构造函数摘要 构造函数 描述 NotSerializableException() 构造一个 NotSerializableException 对象。 NotSerializableException(String classname) 构造带有消息字符串的 NotSerializableException 对象。 方法总结 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 从类 java.lang.Throwable 继承的方法 addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString 构造函数详细信息 NotSerializableException public NotSerializableException(String classname) 构造带有消息字符串的 NotSerializableException 对象。 参数: 参数名称 参数描述 classname 被序列化/反序列化的实例的类。 NotSerializableException public NotSerializableException() 构造一个 NotSerializableException 对象。

鸿蒙OS NotActiveException

NotActiveException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.io.IOException |—|—|—|—java.io.ObjectStreamException |—|—|—|—|—java.io.NotActiveException public class NotActiveException extends ObjectStreamException 当序列化或反序列化不活动时抛出。 Since: JDK1.1 构造函数摘要 构造函数 描述 NotActiveException() 构造函数无缘无故地创建了一个新的 NotActiveException。 NotActiveException(String reason) 构造函数使用给定的原因创建一个新的 NotActiveException。 方法总结 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 从类 java.lang.Throwable 继承的方法 addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString 构造函数详细信息 NotActiveException public NotActiveException(String reason) 构造函数使用给定的原因创建一个新的 NotActiveException。 参数: 参数名称 参数描述 reason 描述异常原因的字符串。 NotActiveException public NotActiveException() 构造函数无缘无故地创建了一个新的 NotActiveException。

鸿蒙OS IOException

IOException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.io.IOException public class IOException extends Exception 表示发生了某种 I/O 异常。 此类是由失败或中断的 I/O 操作产生的一般异常类。 Since: JDK1.0 构造函数摘要 构造函数 描述 IOException() 构造一个以 null 作为其错误详细消息的 IOException。 IOException(String message) 构造一个带有指定详细消息的 IOException。 IOException(String message, Throwable cause) 使用指定的详细消息和原因构造一个 IOException。 IOException(Throwable cause) 构造一个具有指定原因的 IOException 和 (cause==null ? null : cause.toString()) 的详细消息(通常包含原因的类和详细消息)。 方法总结 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 从类 java.lang.Throwable 继承的方法 addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString 构造函数详细信息 IOException public IOException() 构造一个以 null 作为其错误详细消息的 IOException。 IOException public IOException(String message) 构造一个带有指定详细消息的 IOException。 参数: 参数名称 参数描述 message 详细消息(保存以供 Throwable.getMessage() 方法稍后检索) IOException public IOException(String message, Throwable cause) 使用指定的详细消息和原因构造一个 IOException。 请注意,与原因关联的详细消息不会自动合并到此异常的详细消息中。 参数: 参数名称 参数描述 message 详细消息(保存以供 Throwable.getMessage() 方法稍后检索) cause 原因(由 Throwable.getCause() 方法保存以供以后检索)。 (允许使用空值,表示原因不存在或未知。) Since: 1.6 IOException public IOException(Throwable cause) 构造一个具有指定原因的 IOException 和 (cause==null ? null : cause.toString()) 的详细消息(通常包含原因的类和详细消息)。 这个构造函数对于 IO 异常很有用,它只不过是其他 throwable 的包装器。 参数: 参数名称 参数描述 cause 原因(由 Throwable.getCause() 方法保存以供以后检索)。 (允许使用空值,表示原因不存在或未知。) Since: 1.6

鸿蒙OS InvalidObjectException

InvalidObjectException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.io.IOException |—|—|—|—java.io.ObjectStreamException |—|—|—|—|—java.io.InvalidObjectException public class InvalidObjectException extends ObjectStreamException 表示一个或多个反序列化对象未通过验证测试。 论据应提供失败的原因。 Since: JDK1.1, JDK1.1 构造函数摘要 构造函数 描述 InvalidObjectException(String reason) 构造一个 InvalidObjectException。 方法总结 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 从类 java.lang.Throwable 继承的方法 addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString 构造函数详细信息 InvalidObjectException public InvalidObjectException(String reason) 构造一个 InvalidObjectException。 参数: 参数名称 参数描述 reason 解释失败原因的详细消息。

鸿蒙OS InvalidClassException

InvalidClassException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.io.IOException |—|—|—|—java.io.ObjectStreamException |—|—|—|—|—java.io.InvalidClassException public class InvalidClassException extends ObjectStreamException 当序列化运行时检测到类的以下问题之一时引发。 类的串行版本与从流中读取的类描述符的版本不匹配 该类包含未知数据类型 该类没有可访问的无参数构造函数 Since: JDK1.1 字段摘要 修饰符和类型 字段 描述 String classname 无效类的名称。 构造函数摘要 构造函数 描述 InvalidClassException(String reason) 由于指定的原因报告 InvalidClassException。 InvalidClassException(String cname, String reason) 构造一个 InvalidClassException 对象。 方法总结 修饰符和类型 方法 描述 String getMessage() 生成消息并包含类名(如果存在)。 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 从类 java.lang.Throwable 继承的方法 addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString 字段详细信息 classname public String classname 无效类的名称。 构造函数详细信息 InvalidClassException public InvalidClassException(String reason) 由于指定的原因报告 InvalidClassException。 参数: 参数名称 参数描述 reason 描述异常原因的字符串。 InvalidClassException public InvalidClassException(String cname, String reason) 构造一个 InvalidClassException 对象。 参数: 参数名称 参数描述 cname 一个命名无效类的字符串。 reason 描述异常原因的字符串。 方法详情 getMessage public String getMessage() 生成消息并包含类名(如果存在)。 覆盖: 类 Throwable 中的 getMessage 返回: 此 Throwable 实例的详细消息字符串(可能为 null)。

鸿蒙OS InterruptedIOException

InterruptedIOException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.io.IOException |—|—|—|—java.io.InterruptedIOException public class InterruptedIOException extends IOException 表示 I/O 操作已被中断。 抛出 InterruptedIOException 以指示输入或输出传输已终止,因为执行它的线程被中断。 字段 bytesTransferred 指示在中断发生之前成功传输了多少字节。 Since: JDK1.0 字段摘要 修饰符和类型 字段 描述 int bytesTransferred 报告在中断之前作为 I/O 操作的一部分传输了多少字节。 构造函数摘要 构造函数 描述 InterruptedIOException() 构造一个带有 null 作为其错误详细消息的 InterruptedIOException。 InterruptedIOException(String s) 构造带有指定详细消息的 InterruptedIOException。 方法总结 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 从类 java.lang.Throwable 继承的方法 addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString 字段详细信息 bytesTransferred public int bytesTransferred 报告在中断之前作为 I/O 操作的一部分传输了多少字节。 构造函数详细信息 InterruptedIOException public InterruptedIOException() 构造一个带有 null 作为其错误详细消息的 InterruptedIOException。 InterruptedIOException public InterruptedIOException(String s) 构造带有指定详细消息的 InterruptedIOException。 字符串 s 可以稍后通过 java.lang.Throwable 类的 Throwable.getMessage() 方法检索。 参数: 参数名称 参数描述 s 详细信息。

鸿蒙OS FileNotFoundException

FileNotFoundException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.io.IOException |—|—|—|—java.io.FileNotFoundException public class FileNotFoundException extends IOException 表示尝试打开由指定路径名表示的文件失败的信号。 当具有指定路径名的文件不存在时,FileInputStream、FileOutputStream 和 RandomAccessFile 构造函数将引发此异常。 如果文件确实存在但由于某种原因不可访问,例如当试图打开只读文件进行写入时,这些构造函数也会抛出它。 Since: JDK1.0 构造函数摘要 构造函数 描述 FileNotFoundException() 构造一个以 null 作为其错误详细消息的 FileNotFoundException。 FileNotFoundException(String s) 使用指定的详细消息构造 FileNotFoundException。 方法总结 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 从类 java.lang.Throwable 继承的方法 addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString 构造函数详细信息 FileNotFoundException public FileNotFoundException() 构造一个以 null 作为其错误详细消息的 FileNotFoundException。 FileNotFoundException public FileNotFoundException(String s) 使用指定的详细消息构造 FileNotFoundException。 字符串 s 可以稍后通过 java.lang.Throwable 类的 Throwable.getMessage() 方法检索。 参数: 参数名称 参数描述 s 详细信息。