/** * Leave enclosing element */ @Override void leaveEnclosingElement() throws IOException { depthCounter.decLevel(); if(tagQ.size() == 0) throw new IOException("Tried to exit non-existent enclosing element " + "in EditLog file"); EditsElement element = tagQ.pop(); printIndents(); write("</" + element.toString() + ">\n"); }
/** * @see org.apache.hadoop.hdfs.tools.offlineEditsViewer.Tokenizer#read * * @param t a token to read * @return token that was just read */ public Token read(Token t) throws IOException { t.offset = is.getChannel().position(); t.fromString(getNextElementsValue(t.getEditsElement().toString())); return t; } }
/** * Visit an enclosing element (element that cntains other elements) * * @param value a Token to visit */ @Override void visitEnclosingElement(Tokenizer.Token value) throws IOException { printIndents(); write("<" + value.getEditsElement().toString() + ">\n"); tagQ.push(value.getEditsElement()); depthCounter.incLevel(); }
/** * Visit a Token * * @param value a Token to visit */ @Override Tokenizer.Token visit(Tokenizer.Token value) throws IOException { EditsElement ele = value.getEditsElement(); if (ele == EditsElement.OPCODE) { printIndents(); write("<OFFSET>" + value.offset + "</OFFSET>\n"); } writeTag(value.getEditsElement().toString(), value.toString()); return value; }