protected void skipComment() throws IOException { while (c != '\n') readByte(); }
protected void skipWhiteSpace() throws IOException { while (c == ' ' || c == '\t' || c == '\n') readByte(); }
protected void skipWhiteSpace() throws IOException { while (c == ' ' || c == '\t' || c == '\n') readByte(); }
protected void skipComment() throws IOException { while (c != '\n') readByte(); }
protected String readKey() throws IOException { StringBuilder result = new StringBuilder(); while (c >= '0' || c == '-') { result.append(c); readByte(); } return result.toString(); }
protected String readKey() throws IOException { StringBuilder result = new StringBuilder(); while (c >= '0' || c == '-') { result.append(c); readByte(); } return result.toString(); }
protected String readQuotedString() throws FormatException, IOException { int quote = c; if (quote == '(') { quote = ')'; } else if (quote != '"' && quote != '\'') { syntaxError("Invalid quote: " + c); } StringBuilder result = new StringBuilder(); for (;;) { readByte(); if (c == quote) { readByte(); return result.toString(); } if (quote == '"' && c == '\\') { readByte(); } result.append(c); } }
protected String readQuotedString() throws FormatException, IOException { int quote = c; if (quote == '(') { quote = ')'; } else if (quote != '"' && quote != '\'') { syntaxError("Invalid quote: " + c); } StringBuilder result = new StringBuilder(); for (;;) { readByte(); if (c == quote) { readByte(); return result.toString(); } if (quote == '"' && c == '\\') { readByte(); } result.append(c); } }
protected Number readNumber() throws FormatException, IOException { StringBuilder string = new StringBuilder(); while ((c >= '0' && c <= '9') || c == '.' || c == '-' || c == '+' || c == 'e') { string.append(c); readByte(); } try { if (string.indexOf(".") < 0 && string.indexOf("e") < 0) { return Integer.valueOf(string.toString()); } return Double.valueOf(string.toString()); } catch (NumberFormatException e) { syntaxError(e.getMessage()); return null; // shut up the compiler } }
protected Number readNumber() throws FormatException, IOException { StringBuilder string = new StringBuilder(); while ((c >= '0' && c <= '9') || c == '.' || c == '-' || c == '+' || c == 'e') { string.append(c); readByte(); } try { if (string.indexOf(".") < 0 && string.indexOf("e") < 0) { return Integer.valueOf(string.toString()); } return Double.valueOf(string.toString()); } catch (NumberFormatException e) { syntaxError(e.getMessage()); return null; // shut up the compiler } }
protected void readFile(RandomAccessInputStream inputStream) throws FormatException, IOException { String firstLine = inputStream.readLine(); Matcher amiraMeshDef = Pattern.compile("#\\s+(AmiraMesh|Avizo).*?" + "(BINARY|ASCII)(-LITTLE-ENDIAN)*").matcher(firstLine); if (amiraMeshDef.find()) { if (amiraMeshDef.group(2).equals("BINARY")) { littleEndian = amiraMeshDef.group(3) != null; } else if (amiraMeshDef.group(2).equals("ASCII")) { ascii = true; } else { syntaxError("Can't recognise this Amira file type"); } } else { syntaxError("Doesn't seem to be an Amira file"); } column = 0; row = 1; in = inputStream; readByte(); readTopLevel(); extractCoreMetaData(); }
protected void readFile(RandomAccessInputStream inputStream) throws FormatException, IOException { String firstLine = inputStream.readLine(); Matcher amiraMeshDef = Pattern.compile("#\\s+(AmiraMesh|Avizo).*?" + "(BINARY|ASCII)(-LITTLE-ENDIAN)*").matcher(firstLine); if (amiraMeshDef.find()) { if (amiraMeshDef.group(2).equals("BINARY")) { littleEndian = amiraMeshDef.group(3) != null; } else if (amiraMeshDef.group(2).equals("ASCII")) { ascii = true; } else { syntaxError("Can't recognise this Amira file type"); } } else { syntaxError("Doesn't seem to be an Amira file"); } column = 0; row = 1; in = inputStream; readByte(); readTopLevel(); extractCoreMetaData(); }