目录搜索
文字
分享


JavaTM 2 Platform
Standard Ed. 6

java.util.regex
类 PatternSyntaxException

1

2

3

4

5

6

java.lang.Object

  <img src="../../../resources/inherit.gif" alt="继承者 ">java.lang.Throwable

      <img src="../../../resources/inherit.gif" alt="继承者 ">java.lang.Exception

          <img src="../../../resources/inherit.gif" alt="继承者 ">java.lang.RuntimeException

              <img src="../../../resources/inherit.gif" alt="继承者 ">java.lang.IllegalArgumentException

                  <img src="../../../resources/inherit.gif" alt="继承者 "><b>java.util.regex.PatternSyntaxException</b>

所有已实现的接口:
Serializable

1

public class <b>PatternSyntaxException</b>

extends IllegalArgumentException

抛出未经检查的异常,表明正则表达式模式中的语法错误。

从以下版本开始:
1.4
另请参见:
序列化表格

构造方法摘要
PatternSyntaxException(String desc, String regex, int index)
          构造此类的新实例。
 
方法摘要
 String getDescription()
          获取错误的描述。
 int getIndex()
          获取错误的索引。
 String getMessage()
          返回多行字符串,包含语法错误及其索引的描述、错误的正则表达式模式和模式中错误索引的可视化指示。
 String getPattern()
          获取错误的正则表达式模式。
 
从类 java.lang.Throwable 继承的方法
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

PatternSyntaxException

1

2

3

public <b>PatternSyntaxException</b>(String desc,

                              String regex,

                              int index)

构造此类的新实例。

参数:
desc - 错误的描述
regex - 错误的模式
index - 错误模式中的近似索引;如果索引未知,则为 -1
方法详细信息

getIndex

1

public int <b>getIndex</b>()

获取错误的索引。

返回:
错误模式中的近似索引;如果索引未知,则返回 -1

getDescription

1

public String <b>getDescription</b>()

获取错误的描述。

返回:
错误的描述

getPattern

1

public String <b>getPattern</b>()

获取错误的正则表达式模式。

返回:
错误的模式

getMessage

1

public String <b>getMessage</b>()

返回多行字符串,包含语法错误及其索引的描述、错误的正则表达式模式和模式中错误索引的可视化指示。

覆盖:
Throwable 中的 getMessage
返回:
完整的详细消息

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java 2 SDK SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。

上一篇:Pattern下一篇:package-frame