pathtrackingwriter.java

来自「xstream是一个把java object序列化成xml文件的开源库,轻便好用」· Java 代码 · 共 34 行

JAVA
34
字号
package com.thoughtworks.xstream.io.path;import com.thoughtworks.xstream.io.HierarchicalStreamWriter;import com.thoughtworks.xstream.io.WriterWrapper;/** * Wrapper for HierarchicalStreamWriter that tracks the path (a subset of XPath) of the current node that is being written. * * @see PathTracker * @see Path * * @author Joe Walnes */public class PathTrackingWriter extends WriterWrapper {    private final PathTracker pathTracker;    public PathTrackingWriter(HierarchicalStreamWriter writer, PathTracker pathTracker) {        super(writer);        this.pathTracker = pathTracker;    }    public void startNode(String name) {        pathTracker.pushElement(name);        super.startNode(name);    }    public void endNode() {        super.endNode();        pathTracker.popElement();    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?