java.lang.Objectjava.text.ParsePosition
public class ParsePosition
ParsePosition 是 Format 及其子类所使用的简单类,用来在解析过程中跟踪当前位置。各种 Format 类中的 parseObject 方法要求将 ParsePosition 对象作为一个变量。
解析具有不同格式的字符串时,可以使用同一个 ParsePosition,因为索引参数记录的是当前位置。
Format
| 构造方法摘要 | |
|---|---|
ParsePosition(int index) 创建一个具有给定初始索引的新 ParsePosition。 |
|
| 方法摘要 | |
|---|---|
boolean |
equals(Object obj) 重写 equals |
int |
getErrorIndex() 获取出错时的索引,如果没有设置错误索引,则为 -1。 |
int |
getIndex() 获取当前的解析位置。 |
int |
hashCode() 返回此 ParsePosition 的哈希码。 |
void |
setErrorIndex(int ei) 设置解析出错时的索引。 |
void |
setIndex(int index) 设置当前解析位置。 |
String |
toString() 返回此 ParsePosition 的字符串表示形式。 |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| 构造方法详细信息 |
|---|
public ParsePosition(int index)
| 方法详细信息 |
|---|
public int getIndex()
public void setIndex(int index)
public void setErrorIndex(int ei)
public int getErrorIndex()
public boolean equals(Object obj)
obj - 要与之比较的引用对象。
true;否则返回
false。
Object.hashCode(),
Hashtable
public int hashCode()
Object.equals(java.lang.Object),
Hashtable
public String toString()