Most visited

Recently visited

Added in API level 8

TransformerException

public class TransformerException
extends 异常

java.lang.Object
    java.lang.Throwable
      java.lang.Exception
        javax.xml.transform.TransformerException
Known Direct Subclasses


此类指定在转换过程中发生的异常情况。

摘要(Summary)

Public constructors

TransformerException(String message)

创建一个新的TransformerException。

TransformerException(Throwable e)

创建一个包装现有异常的新TransformerException。

TransformerException(String message, Throwable e)

在TransformerException中包装现有异常。

TransformerException(String message, SourceLocator locator)

从消息和定位器中创建一个新的TransformerException。

TransformerException(String message, SourceLocator locator, Throwable e)

在TransformerException中包装现有异常。

公共方法(Public methods)

Throwable getCause()

如果原因不存在或未知,则返回此throwable或 null的原因。

Throwable getException()

此方法检索此例外包装的异常。

String getLocationAsString()

以字符串形式获取位置信息。

SourceLocator getLocator()

getLocator方法检索指定发生错误的SourceLocator对象的实例。

String getMessageAndLocation()

获取附加位置信息的错误消息。

Throwable initCause(Throwable cause)

将此throwable的 原因初始化为指定值。

void printStackTrace()

打印错误发生地点的方法跟踪。

void printStackTrace(PrintWriter s)

打印错误发生地点的方法跟踪。

void printStackTrace(PrintStream s)

打印错误发生地点的方法跟踪。

void setLocator(SourceLocator location)

方法setLocator设置指定错误发生位置的SourceLocator对象的实例。

继承方法(Inherited methods)

From class java.lang.Throwable
From class java.lang.Object

Public constructors

TransformerException

Added in API level 8
TransformerException (String message)

创建一个新的TransformerException。

参数(Parameters)
message String: The error or warning message.

TransformerException

Added in API level 8
TransformerException (Throwable e)

创建一个包装现有异常的新TransformerException。

参数(Parameters)
e Throwable: The exception to be wrapped.

TransformerException

Added in API level 8
TransformerException (String message, 
                Throwable e)

在TransformerException中包装现有异常。

这用于在处理开始之前抛出处理器异常。

参数(Parameters)
message String: The error or warning message, or null to use the message from the embedded exception.
e Throwable: Any exception

TransformerException

Added in API level 8
TransformerException (String message, 
                SourceLocator locator)

从消息和定位器中创建一个新的TransformerException。

当应用程序在DocumentHandler回调中创建自己的异常时,此构造函数特别有用。

参数(Parameters)
message String: The error or warning message.
locator SourceLocator: The locator object for the error or warning.

TransformerException

Added in API level 8
TransformerException (String message, 
                SourceLocator locator, 
                Throwable e)

在TransformerException中包装现有异常。

参数(Parameters)
message String: The error or warning message, or null to use the message from the embedded exception.
locator SourceLocator: The locator object for the error or warning.
e Throwable: Any exception

公共方法(Public methods)

getCause

Added in API level 8
Throwable getCause ()

如果原因不存在或未知,则返回此throwable或null的原因。 (原因是导致此throwable被抛出的throwable。)

返回(Returns)
Throwable the cause of this throwable or null if the cause is nonexistent or unknown.

getException

Added in API level 8
Throwable getException ()

此方法检索此例外包装的异常。

返回(Returns)
Throwable An Throwable object, or null.

也可以看看:

getLocationAsString

Added in API level 8
String getLocationAsString ()

以字符串形式获取位置信息。

返回(Returns)
String A string with location info, or null if there is no location information.

getLocator

Added in API level 8
SourceLocator getLocator ()

getLocator方法检索指定发生错误的SourceLocator对象的实例。

返回(Returns)
SourceLocator A SourceLocator object, or null if none was specified.

getMessageAndLocation

Added in API level 8
String getMessageAndLocation ()

获取附加位置信息的错误消息。

返回(Returns)
String A String representing the error message with location information appended.

initCause

Added in API level 8
Throwable initCause (Throwable cause)

将此throwable的原因初始化为指定值。 (原因是导致此throwable被抛出的throwable。)

该方法最多可以调用一次。 它通常在构造函数中调用,或者在创建throwable之后立即调用。 如果这个throwable是用TransformerException(Throwable)TransformerException(String, Throwable)创建的,这个方法甚至不能被调用一次。

参数(Parameters)
cause Throwable: the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
返回(Returns)
Throwable a reference to this Throwable instance.
抛出异常(Throws)
IllegalArgumentException if cause is this throwable. (A throwable cannot be its own cause.)
IllegalStateException if this throwable was created with TransformerException(Throwable) or TransformerException(String, Throwable), or this method has already been called on this throwable.

printStackTrace

Added in API level 8
void printStackTrace ()

打印错误发生地点的方法跟踪。 这将跟踪所有嵌套的异常对象以及此对象。

printStackTrace

Added in API level 8
void printStackTrace (PrintWriter s)

打印错误发生地点的方法跟踪。 这将跟踪所有嵌套的异常对象以及此对象。

参数(Parameters)
s PrintWriter: The writer where the dump will be sent to.

printStackTrace

Added in API level 8
void printStackTrace (PrintStream s)

打印错误发生地点的方法跟踪。 这将跟踪所有嵌套的异常对象以及此对象。

参数(Parameters)
s PrintStream: The stream where the dump will be sent to.

setLocator

Added in API level 8
void setLocator (SourceLocator location)

方法setLocator设置指定错误发生位置的SourceLocator对象的实例。

参数(Parameters)
location SourceLocator: A SourceLocator object, or null to clear the location.

Hooray!