@Override protected void addElem( final int dist, final int name, final int asize, final int uri, final boolean ne) throws IOException { tout.write1(asize << 3 | Data.ELEM); tout.write2((ne ? 1 << 15 : 0) | name); tout.write1(uri); tout.write4(dist); tout.write4(asize); tout.write4(meta.size++); if (Prop.debug && (c++ & 0x7FFFF) == 0) Util.err("."); }
@Override protected void addText(final byte[] value, final int dist, final byte kind) throws IOException { tout.write1(kind); tout.write2(0); tout.write5(textOff(value, true)); tout.write4(dist); tout.write4(meta.size++); }
@Override protected void addDoc(final byte[] value) throws IOException { tout.write1(Data.DOC); tout.write2(0); tout.write5(textOff(value, true)); tout.write4(0); tout.write4(meta.size++); }
@Override protected void addAttr(final int name, final byte[] value, final int dist, final int uri) throws IOException { tout.write1(dist << 3 | Data.ATTR); tout.write2(name); tout.write5(textOff(value, false)); tout.write4(uri); tout.write4(meta.size++); }
/** * Writes the node to the specified output stream. * * @param out output stream * @throws IOException I/O exception */ void write(final DataOutput out) throws IOException { out.writeNum(name); out.write1(kind); out.writeNum(0); out.writeNum(children.length); out.writeDouble(1); // update leaf flag boolean leaf = stats.isLeaf(); for (final PathNode child : children) { leaf &= child.kind == Data.TEXT || child.kind == Data.ATTR; } stats.setLeaf(leaf); stats.write(out); for (final PathNode child : children) child.write(out); }