3 import java.io.BufferedReader;
4 import java.io.IOException;
6 import java.io.StringReader;
9 * Just a simple abstract class to join a String reader and a String[]
10 * reader under the same BufferedReader umbrella.
12 * Subclassed as StringDataReader, ArrayDataReader, and ListDataReader
16 public abstract class DataReader extends BufferedReader {
18 public abstract DataReader setData(Object data);
23 super(new StringReader(""));
26 protected DataReader(Reader in) {
30 public BufferedReader getBufferedReader() {
34 protected int readBuf(char[] buf, int off, int len) throws IOException {
35 // not used by StringDataReader
37 String line = readLine();
41 int linelen = line.length();
42 for (int i = off; i < len && linelen >= 0; i++) {
43 if (linept >= linelen) {
47 linelen = (line == null ? -1 : line.length());
49 buf[i] = line.charAt(linept++);