Package: java.io.* |
Product: JDK |
Release: 1.0.2 |
Related Links: |
General
File
FilenameFilter
FileWriter
JPEGCodec
ObjectInputStream
OutputStream
PipedInputStream
PrintWriter
StreamTokenizer
|
Comment: |
/** * Insert the method's description here. * Creation date: (8/13/00 4:37:30 PM) * @param syntax int */ public List createElements(Reader r, int syntax, int line) throws Exception { Vector elements = new Vector(); StreamTokenizer st = new StreamTokenizer(r); st.resetSyntax(); switch (syntax) { case EDILINES : st.ordinaryChar('\''); st.wordChars('A', 'z'); st.wordChars('+', '@'); st.wordChars(' ', ' '); st.wordChars('(', ')'); st.wordChars('\"', '\"'); break; case EDIFIELDS : st.ordinaryChar('\''); //st.ordinaryChar('/'); st.wordChars('A', 'z'); st.wordChars('0', '9'); st.wordChars(' ', ' '); st.wordChars('(', ')'); st.wordChars('<', '>'); st.wordChars('?', '?'); st.wordChars('/', '/'); break; default : return null; } int type = -1; //System.out.println(); int i = 0; int element = 0; outer : while ((type = st.nextToken()) != StreamTokenizer.TT_EOF) { try { //System.out.print("."); switch (type) { case StreamTokenizer.TT_WORD : if (syntax == EDIFIELDS) dbg(">- (" + line + "|" + i + "): " + st.sval + " (" + element + ")"); elements.addElement(st.sval); i++; break; case StreamTokenizer.TT_EOF : break outer; default : break; } element++; } catch (Throwable t) { t.printStackTrace(); } } //System.out.println(); r.close(); return elements; } |