Example usage for java.io PrintStream print

List of usage examples for java.io PrintStream print

Introduction

In this page you can find the example usage for java.io PrintStream print.

Prototype

public void print(Object obj) 

Source Link

Document

Prints an object.

Usage

From source file:Main.java

public static void writeString(Context context, String content, String path) {
    try {//from w ww.  ja va  2s . co m
        FileOutputStream fos = context.openFileOutput(path, Context.MODE_PRIVATE);
        PrintStream ps = new PrintStream(fos);
        ps.print(content);
        ps.close();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
}

From source file:mjc.ARMMain.java

private static void emitInstructions(TempMap tm, Proc proc, PrintStream out) {
    out.print(proc.begin);
    InstrList islist = proc.body;/*from  www .  ja va 2s.  c o  m*/
    while (islist != null) {
        out.println(islist.head.format(tm));
        islist = islist.tail;
    }
    out.print(proc.end);
}

From source file:graphgen.GraphGen.java

private static void saveGraph(String graph, String fileName) throws FileNotFoundException {
    PrintStream out = new PrintStream(new FileOutputStream(fileName));
    out.print(graph);
    System.out.println("Created Graph");
}

From source file:Main.java

/***
 *  Print every attribute and value of a node, one line at a time.
 *  If {@link entry} is null, then outputs "<null/>".
 *
 * @param outs where to send output, cannot be null.
 * @param entry XML node to examine, OK if null.
 *///from  w w  w.j  a  va 2  s  .  co  m
public static void XmlPrintAttrs(PrintStream outs, Node entry) {
    if (entry == null) {
        outs.print("<null/>");
        return;
    }

    //  see http://www.w3.org/2003/01/dom2-javadoc/org/w3c/dom/NamedNodeMap.html
    NamedNodeMap attrs = entry.getAttributes();

    for (int k = attrs.getLength(); --k >= 0;) {
        Node n = attrs.item(k);
        outs.printf("+++ has attr %s = %s\n", n.getNodeName(), n.getNodeValue());
    }
}

From source file:Main.java

public static void printStackTrace(final StackTraceElement[] stack, PrintStream out) {
    final StringBuffer b = new StringBuffer();
    printStackTrace(stack, b);/*from  w w  w. j  av a2 s.c  om*/
    out.print(b.toString());
}

From source file:Hexdump.java

public static void print(byte[] buf, int width, PrintStream out) {
    out.print(format(buf, width));
}

From source file:Hexdump.java

public static void print(byte[] buf, PrintStream out) {
    out.print(format(buf));
}

From source file:org.nuxeo.connect.tools.report.viewer.Viewer.java

public static PrintStream printThreadDeadlocked(MappingIterator<Long> values, PrintStream out)
        throws IOException {
    out.print("deadlocked " + Arrays.toString(values.readAll().toArray()));
    return out;/*from w  w  w.  ja  v  a 2  s  .  c o  m*/
}

From source file:org.nuxeo.connect.tools.report.viewer.Viewer.java

public static PrintStream printThreadMonitorDeadlocked(MappingIterator<Long> values, PrintStream out)
        throws IOException {
    out.print("monitor deadlocked " + Arrays.toString(values.readAll().toArray()));
    return out;// w w  w. j  a v a  2s.  c  o m
}

From source file:TextFieldViews.java

public static void displayView(View view, int indent, Document doc, PrintStream out) {
    String name = view.getClass().getName();
    for (int i = 0; i < indent; i++) {
        out.print("\t");
    }/*from w w  w  .j a v  a  2  s . c  o m*/

    int start = view.getStartOffset();
    int end = view.getEndOffset();
    out.println(name + "; offsets [" + start + ", " + end + "]");
    int viewCount = view.getViewCount();
    if (viewCount == 0) {
        int length = Math.min(32, end - start);
        try {
            String txt = doc.getText(start, length);
            for (int i = 0; i < indent + 1; i++) {
                out.print("\t");
            }
            out.println("[" + txt + "]");
        } catch (BadLocationException e) {
        }
    } else {
        for (int i = 0; i < viewCount; i++) {
            displayView(view.getView(i), indent + 1, doc, out);
        }
    }
}