public String peekNextChild() { if (depthState.hasMoreChildren()) { return idRegistry.get(pushback.getId()); } return null; }
public void startNode(String name) { write(new Token.StartNode(idRegistry.getId(name))); }
public void addAttribute(String name, String value) { write(new Token.Attribute(idRegistry.getId(name), value)); }
private Token contructToken(byte type) { switch (type) { case Token.TYPE_START_NODE: return new StartNode(); case Token.TYPE_MAP_ID_TO_VALUE: return new MapIdToValue(); case Token.TYPE_ATTRIBUTE: return new Attribute(); case Token.TYPE_END_NODE: return new EndNode(); case Token.TYPE_VALUE: return new Value(); default: throw new StreamException("Unknown token type"); } } }
public void setValue(String text) { write(new Token.Value(text)); }
public void endNode() { write(new Token.EndNode()); }
public void readFrom(DataInput in, byte idType) throws IOException { this.id = readId(in, idType); this.value = readString(in); }
public void readFrom(DataInput in, byte idType) throws IOException { id = readId(in, idType); value = readString(in); }
public void writeTo(DataOutput out, byte idType) throws IOException { writeId(out, id, idType); writeString(out, value); }
public void writeTo(DataOutput out, byte idType) throws IOException { writeId(out, id, idType); writeString(out, value); }
public Token read(DataInput in) throws IOException { byte nextByte = in.readByte(); byte type = (byte) (nextByte & TYPE_MASK); byte idType = (byte) (nextByte & ID_MASK); Token token = contructToken(type); token.readFrom(in, idType); return token; }
public void push() { State newState = new State(); newState.parent = current; current = newState; }
public HierarchicalStreamWriter createWriter(OutputStream out) { return new BinaryStreamWriter(out); } }
public void readFrom(DataInput in, byte idType) throws IOException { value = readString(in); }
public String getAttribute(String name) { return depthState.getAttribute(name); }
public Iterator getAttributeNames() { return depthState.getAttributeNames(); }
public HierarchicalStreamReader createReader(InputStream in) { return new BinaryStreamReader(in); }
public boolean hasMoreChildren() { return depthState.hasMoreChildren(); }
public String getAttributeName(int index) { return depthState.getAttributeName(index); }
public void startNode(String name, Class clazz) { startNode(name); }