All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.day.jcr.vault.fs.api.DumpContext Maven / Gradle / Ivy

/*************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * __________________
 *
 *  Copyright 2011 Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 *
 **************************************************************************/

package com.day.jcr.vault.fs.api;

import java.io.PrintWriter;
import java.util.LinkedList;

/**
 * DumpHandler...
 *
 */
public class DumpContext {

    private final PrintWriter out;

    private LinkedList stack = new LinkedList();

    public DumpContext(PrintWriter out) {
        this.out = out;
        stack.add("");
    }

    public void println(String str) {
        out.println(str);
    }
    
    public void println(boolean isLast, String str) {
        out.print(stack.getLast());
        out.print(isLast ? "`-- " : "|-- ");
        out.println(str);
    }

    public void printf(boolean isLast, String format, Object ... args) {
        println(isLast, String.format(format, args));
    }
    
    public void indent(boolean isLast) {
        String ind = stack.getLast() + (isLast ? "    " : "|   ");
        stack.addLast(ind);
    }

    public void outdent() {
        stack.removeLast();
    }

    public void flush() {
        out.flush();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy