鴻蒙OS InvalidClassException

2022-10-27 09:50 更新

InvalidClassException

java.lang.Object

|---java.lang.Throwable

|---|---java.lang.Exception

|---|---|---java.io.IOException

|---|---|---|---java.io.ObjectStreamException

|---|---|---|---|---java.io.InvalidClassException

public class InvalidClassException
extends ObjectStreamException

當(dāng)序列化運(yùn)行時(shí)檢測(cè)到類的以下問題之一時(shí)引發(fā)。

  • 類的串行版本與從流中讀取的類描述符的版本不匹配
  • 該類包含未知數(shù)據(jù)類型
  • 該類沒有可訪問的無參數(shù)構(gòu)造函數(shù)

Since:

JDK1.1

字段摘要

修飾符和類型 字段 描述
String classname 無效類的名稱。

構(gòu)造函數(shù)摘要

構(gòu)造函數(shù) 描述
InvalidClassException(String reason) 由于指定的原因報(bào)告 InvalidClassException。
InvalidClassException(String cname, String reason) 構(gòu)造一個(gè) InvalidClassException 對(duì)象。

方法總結(jié)

修飾符和類型 方法 描述
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

字段詳細(xì)信息

classname

public String classname

無效類的名稱。

構(gòu)造函數(shù)詳細(xì)信息

InvalidClassException

public InvalidClassException(String reason)

由于指定的原因報(bào)告 InvalidClassException。

參數(shù):

參數(shù)名稱 參數(shù)描述
reason 描述異常原因的字符串。

InvalidClassException

public InvalidClassException(String cname, String reason)

構(gòu)造一個(gè) InvalidClassException 對(duì)象。

參數(shù):

參數(shù)名稱 參數(shù)描述
cname 一個(gè)命名無效類的字符串。
reason 描述異常原因的字符串。

方法詳情

getMessage

public String getMessage()

生成消息并包含類名(如果存在)。

覆蓋:

類 Throwable 中的 getMessage

返回:

此 Throwable 實(shí)例的詳細(xì)消息字符串(可能為 null)。

以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)