### StringReader中双指针
1. 一个为next指针
1. next指针为:标记读取到的位置,用于读取下一个字符
2. 一个为mark指针
1. mark指针为:标记回退时候的位置,用于回退的时候使用,类似于回溯
3. 读取一个字符,next指针+1
4. 调用mark方法,mark设置为next的值
5. 调用reset方法,将next指针设置为mark的值
```
public static void main(String[] args) throws Exception {
StringReader str_r = null;
try {
// Instantiates StringReader
str_r = new StringReader("JavaWorld!");
// By using read() method isto
// read the character from str_r
char ch1 = (char) str_r.read();
char ch2 = (char) str_r.read();
char ch3 = (char) str_r.read();
System.out.println("ch1: " + ch1);
System.out.println("ch2: " + ch2);
System.out.println("ch3: " + ch3);
// By using mark() method isto
// set the current position in this
// str_r
System.out.println("str_r.mark(1): ");
// str_r.mark(1);
str_r.mark(0);
char ch4 = (char) str_r.read();
char ch5 = (char) str_r.read();
System.out.println("ch4: " + ch4);
System.out.println("ch5: " + ch5);
// By using reset() method isto
// reset the stream to the position
// set by the call mark() method
System.out.println("str_r.reset(): ");
str_r.reset();
char ch6 = (char) str_r.read();
char ch7 = (char) str_r.read();
char ch8 = (char) str_r.read();
char ch9 = (char) str_r.read();
char ch10 = (char) str_r.read();
char ch11 = (char) str_r.read();
char ch12 = (char) str_r.read();
System.out.println("ch4: " + ch6);
System.out.println("ch5: " + ch7);
System.out.println("ch6: " + ch8);
System.out.println("ch7: " + ch9);
System.out.println("ch8: " + ch10);
System.out.println("ch9: " + ch11);
System.out.println("ch10: " + ch12);
} catch (Exception ex) {
System.out.println(ex.toString());
} finally {
// with the help of this block is to
// free all necessary resources linked
// with the stream
if (str_r != null) {
str_r.close();
}
}
}
```