/** Returns a concatenation of the remaining strings from a Tokenizer. */ private String remainingStrings() throws IOException { StringBuffer buffer = null; while (true) { Tokenizer.Token t = get(); if (!t.isString()) break; if (buffer == null) buffer = new StringBuffer(); buffer.append(t.value); } unget(); if (buffer == null) return null; return buffer.toString(); }
void rdataFromString(Tokenizer st, Name origin) throws IOException { try { address = byteArrayFromString(st.getString()); Tokenizer.Token t = st.get(); if (t.isString()) { subAddress = byteArrayFromString(t.value); } else { st.unget(); } } catch (TextParseException e) { throw st.exception(e.getMessage()); } }
public TypeBitmap(Tokenizer st) throws IOException { this(); while (true) { Tokenizer.Token t = st.get(); if (!t.isString()) break; int typecode = Type.value(t.value); if (typecode < 0) { throw st.exception("Invalid type: " + t.value); } types.add(Mnemonic.toInteger(typecode)); } st.unget(); }
private long parseDouble( Tokenizer st, String type, boolean required, long min, long max, long defaultValue) throws IOException { Tokenizer.Token token = st.get(); if (token.isEOL()) { if (required) throw st.exception("Invalid LOC " + type); st.unget(); return defaultValue; } String s = token.value; if (s.length() > 1 && s.charAt(s.length() - 1) == 'm') s = s.substring(0, s.length() - 1); try { long value = (long) (100 * parseFixedPoint(s)); if (value < min || value > max) throw st.exception("Invalid LOC " + type); return value; } catch (NumberFormatException e) { throw st.exception("Invalid LOC " + type); } }