int currentChar; try { currentChar = read(); } catch (IOException e) { if (i != 0) {
LabelParser (File file) throws InvalidLabelFileException { this.file = file ; try { this.in = (new LineNumberInputStream (new BufferedInputStream (new FileInputStream (file)))) ; this.buffer = new byte[32] ; this.ch = in.read() ; } catch (IOException e) { throw new InvalidLabelFileException (file.getAbsolutePath() + ": IO exception.") ; } }
/** * This will parse the provided file and returns the parsed key and value content * * @param propertiesStream the Reader of property information * @return a list of {@link PropertiesEntry}s * @throws IOException if something cant be read */ public List<PropertiesEntry> parse(InputStream propertiesStream) throws IOException { List<PropertiesEntry> entryList = new ArrayList<PropertiesEntry>(); LineNumberInputStream in = new LineNumberInputStream(propertiesStream); try { StringBuilder currentComment = new StringBuilder(); String line = readLine(in); while (line != null) { // does it start with a comment marker if (isCommentOrWhiteSpaceLine(line)) { currentComment.append(line).append('\n'); line = readLine(in); } else { // we have changed state. Its a property value. line = readEntryPrimed(in, currentComment, entryList, line, in.getLineNumber()); } } } finally { in.close(); } return entryList; }
@Override protected InputStream newInputStream() throws IOException { push(); InputStream in = super.newInputStream(); pop(); return new java.io.LineNumberInputStream(in); }
/** * Parser expects given character. */ void expect (int c) throws InvalidLabelException { if ( ch == c ) return ; String msg = ("expected " + (new Character((char) c)).toString() + "[" + c + "]" + " got " + (new Character((char) ch)).toString() + "[" + ch + "]"); if (file == null) throw new InvalidLabelException(in.getLineNumber(), msg) ; else throw new InvalidLabelFileException (file, in.getLineNumber(), msg) ; }
LabelParser (String string) throws InvalidLabelException { try { this.in = (new LineNumberInputStream (new BufferedInputStream (new StringBufferInputStream (string)))) ; this.buffer = new byte[32] ; this.ch = in.read() ; } catch (IOException e) { throw new InvalidLabelException( "IO exception.") ; } }
nr = read(data, 0, (int) Math.min(chunk, remaining)); if (nr < 0) { break;
nr = read(data, 0, (int) Math.min(chunk, remaining)); if (nr < 0) { break;
String parseVariableName () throws IOException { while ((ch != '=') && (ch != '\n') && (ch != -1)) { append (Character.toLowerCase((char)ch)) ; ch = in.read() ; } return getToken(true) ; }
String parseVariableValue() throws IOException { while ( (ch != -1) && (ch != '\n') ) { append (ch) ; ch = in.read() ; } return getToken(true) ; }
int currentChar; try { currentChar = read(); } catch (IOException e) { if (i != 0) {
int currentChar; try { currentChar = read(); } catch (IOException e) { if (i != 0) {
int currentChar; try { currentChar = read(); } catch (IOException e) { if (i != 0) {
int currentChar; try { currentChar = read(); } catch (IOException e) { if (i != 0) {
int currentChar; try { currentChar = read(); } catch (IOException e) { if (i != 0) {
int currentChar; try { currentChar = read(); } catch (IOException e) { if (i != 0) {
int currentChar; try { currentChar = read(); } catch (IOException e) { if (i != 0) {