1 17 18 package org.objectweb.jac.util.preparse; 19 20 import java.io.BufferedReader ; 21 import java.io.Reader ; 22 import java.io.IOException ; 23 24 public class ParseInput extends BufferedReader 25 { 26 String currentLine; 27 boolean modified = false; 28 29 public ParseInput(Reader in) 30 { 31 super(in); 32 } 33 34 public ParseInput(Reader in, int sz) 35 { 36 super(in, sz); 37 } 38 39 42 public String readLine() 43 throws IOException 44 { 45 if (modified) 46 modified = false; 47 else 48 currentLine = super.readLine(); 49 return currentLine; 50 } 51 52 public boolean isModified() 53 { 54 return modified; 55 } 56 57 61 public String skipTo(int i, String token) 62 throws IOException 63 { 64 String result = new String (); 66 do 67 { 68 int lineLength = currentLine.length(); 69 70 int begin = i; 71 int end; 72 73 for (end = token.length() + i; end <= lineLength; begin++, end++) 74 { 75 if (currentLine.substring(begin, end).equals(token)) 76 { 77 currentLine = currentLine.substring(end); 79 modified = true; 80 return result; 81 } 82 } 83 result += '\n'; 86 i = 0; 87 } 88 while (readLine() != null); 89 return result; 90 } 91 } 92 | Popular Tags |