后浪云鸿蒙OS教程:鸿蒙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

文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/156240.html<

(0)
运维的头像运维
上一篇2025-03-15 19:55
下一篇 2025-03-15 19:57

相关推荐

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注