/** * Create a new Decoder with the state and appropriate API. * * @return a Decoder */ public Decoder dec() { return new Decoder(this); }
void parseArray(Collection<Object> list, Type componentType, Decoder r) throws Exception { assert r.current() == '['; int c = r.next(); while (START_CHARACTERS.indexOf(c) >= 0) { Object o = decode(componentType, r); list.add(o); c = r.skipWs(); if (c == ']') break; if (c == ',') { c = r.next(); continue; } throw new IllegalArgumentException( "Invalid character in parsing list, expected ] or , but found " + (char) c); } assert r.current() == ']'; r.read(); // skip closing }
Object decode(Type type, Decoder isr) throws Exception { int c = isr.skipWs(); Handler h; isr.expect("ull"); return null; isr.expect("rue"); return true; isr.expect("alse"); return false; isr.expect("ull"); return h.decode(isr); isr.expect("rue"); return h.decode(isr, Boolean.TRUE); isr.expect("alse"); return h.decode(isr, Boolean.FALSE);
public Decoder from(InputStream in) throws Exception { if (inflate) in = new InflaterInputStream(in); return from(new InputStreamReader(in, encoding)); }
public Object get() throws Exception { try { return codec.decode(null, this); } finally { if (!keepOpen) close(); } }
public Decoder from(Reader in) throws Exception { reader = in; read(); return this; }
public boolean isEof() throws Exception { int c = skipWs(); return c < 0; }
void parseArray(Collection<Object> list, Type componentType, Decoder r) throws Exception { assert r.current() == '['; int c = r.next(); while (START_CHARACTERS.indexOf(c) >= 0) { Object o = decode(componentType, r); list.add(o); c = r.skipWs(); if (c == ']') break; if (c == ',') { c = r.next(); continue; } throw new IllegalArgumentException("Invalid character in parsing list, expected ] or , but found " + (char) c); } assert r.current() == ']'; r.read(); // skip closing }
Object decode(Type type, Decoder isr) throws Exception { int c = isr.skipWs(); Handler h; isr.expect("ull"); return null; isr.expect("rue"); return true; isr.expect("alse"); return false; isr.expect("ull"); return h.decode(isr); isr.expect("rue"); return h.decode(isr,Boolean.TRUE); isr.expect("alse"); return h.decode(isr,Boolean.FALSE);
public Decoder from(InputStream in) throws Exception { if ( inflate) in = new InflaterInputStream(in); return from(new InputStreamReader(in, encoding)); }
public Object get(Type type) throws Exception { try { return codec.decode(type, this); } finally { if (!keepOpen) close(); } }
public Decoder from(Reader in) throws Exception { reader = in; read(); return this; }
void parseArray(Collection<Object> list, Type componentType, Decoder r) throws Exception { assert r.current() == '['; int c = r.next(); while (START_CHARACTERS.indexOf(c) >= 0) { Object o = decode(componentType, r); list.add(o); c = r.skipWs(); if (c == ']') break; if (c == ',') { c = r.next(); continue; } throw new IllegalArgumentException("Invalid character in parsing list, expected ] or , but found " + (char) c); } assert r.current() == ']'; r.read(); // skip closing }