鸿蒙OS开发文档 鸿蒙OS UncheckedIOException

2024-02-25 开发教程 鸿蒙OS开发文档 匿名 5

UncheckedIOException

java.lang.Object
|---java.lang.Throwable
|---|---java.lang.Exception
|---|---|---java.lang.RuntimeException
|---|---|---|---java.io.UncheckedIOException

public class UncheckedIOException
extends RuntimeException

用未经检查的异常包装 IOException。

Since:

1.8

构造函数摘要

构造函数描述
UncheckedIOException(IOException cause)构造此类的一个实例。
UncheckedIOException(String message, IOException cause)构造此类的一个实例。

方法总结

修饰符和类型方法描述
IOExceptiongetCause()返回此异常的原因。
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
从类 java.lang.Throwable 继承的方法
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString

构造函数详细信息

UncheckedIOException

public UncheckedIOException(String message, IOException cause)

构造此类的一个实例。

参数:

参数名称参数描述
message详细信息,可以为空
causeIO异常

Throws:

Throw名称Throw描述
NullPointerException如果 cause 为空

UncheckedIOException

public UncheckedIOException(IOException cause)

构造此类的一个实例。

参数:

参数名称参数描述
causeIO异常

Throws:

Throw名称Throw描述
NullPointerException如果 cause 为空

方法详情

getCause

public IOException getCause()

返回此异常的原因。

覆盖:

类 Throwable 中的 getCause

返回:

IOException 是导致此异常的原因。