1
2
3
4
5
6
7
8
9
10
11 package psiprobe.tokenizer;
12
13 import java.io.IOException;
14 import java.io.StringReader;
15
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18
19
20
21
22 public class StringTokenizer extends Tokenizer {
23
24
25 private static final Logger logger = LoggerFactory.getLogger(StringTokenizer.class);
26
27
28
29
30 public StringTokenizer() {
31
32 }
33
34
35
36
37
38
39 public StringTokenizer(final String str) {
40 setString(str);
41 }
42
43
44
45
46
47
48 public void setString(final String str) {
49 setReader(new StringReader(str));
50 }
51
52 @Override
53 public boolean hasMore() {
54 try {
55 return super.hasMore();
56 } catch (IOException e) {
57 logger.trace("", e);
58 return false;
59 }
60 }
61
62 @Override
63 public Token getToken() {
64 try {
65 return super.getToken();
66 } catch (IOException e) {
67 logger.trace("", e);
68 return null;
69 }
70 }
71
72 @Override
73 public Token nextToken() {
74 try {
75 return super.nextToken();
76 } catch (IOException e) {
77 logger.trace("", e);
78 return null;
79 }
80 }
81
82 }