Package java.io

Examples of java.io.PrintWriter.format()


        boolean needsPrefix = !report.exists();
        PrintWriter writer = new PrintWriter(
                new FileWriterWithEncoding(report, "UTF-8", true));
        try {
            if (needsPrefix) {
                writer.format(
                        "# %-34.34s     min     10%%     50%%     90%%     max%n",
                        test);
            }

            writer.format(
View Full Code Here


                writer.format(
                        "# %-34.34s     min     10%%     50%%     90%%     max%n",
                        test);
            }

            writer.format(
                    "%-36.36s  %6.0f  %6.0f  %6.0f  %6.0f  %6.0f%n",
                    name,
                    statistics.getMin(),
                    statistics.getPercentile(10.0),
                    statistics.getPercentile(50.0),
View Full Code Here

        if (!current) {
            rootcount = data.getShort(data.position() + 1) &0xffff;
            length -= (align(3 + rootcount * 3) + refids.length * 16);
        }

        writer.format(
                "Segment %s (%d bytes, %d ref%s, %d root%s)%n",
                uuid, length,
                refids.length, (refids.length != 1 ? "s" : ""),
                rootcount, (rootcount != 1 ? "s" : ""));
        writer.println("--------------------------------------------------------------------------");
View Full Code Here

                refids.length, (refids.length != 1 ? "s" : ""),
                rootcount, (rootcount != 1 ? "s" : ""));
        writer.println("--------------------------------------------------------------------------");
        if (refids.length > 0) {
            for (int i = 0; i < refids.length; i++) {
                writer.format("reference %02x: %s%n", i, refids[i]);
            }
            writer.println("--------------------------------------------------------------------------");
        }
        int pos = data.limit() - ((length + 15) & ~15);
        while (pos < data.limit()) {
View Full Code Here

            }
            writer.println("--------------------------------------------------------------------------");
        }
        int pos = data.limit() - ((length + 15) & ~15);
        while (pos < data.limit()) {
            writer.format("%04x: ", (MAX_SEGMENT_SIZE - data.limit() + pos) >> RECORD_ALIGN_BITS);
            for (int i = 0; i < 16; i++) {
                if (i > 0 && i % 4 == 0) {
                    writer.append(' ');
                }
                if (pos + i >= data.position()) {
View Full Code Here

                if (i > 0 && i % 4 == 0) {
                    writer.append(' ');
                }
                if (pos + i >= data.position()) {
                    byte b = data.get(pos + i);
                    writer.format("%02x ", b & 0xff);
                } else {
                    writer.append("   ");
                }
            }
            writer.append(' ');
View Full Code Here

            String alias;
            if (argDump.isSet()) {
                alias = getAlias();
                SyntaxBundle bundle = synMgr.getSyntaxBundle(alias);
                if (bundle == null) {
                    err.format(err_no_alias, alias);
                } else {
                    dumpSyntax(alias, bundle, out);
                }
            } else if (argFile.isSet()) {
                alias = getAlias();
View Full Code Here

                    xml.setAttribute("alias", alias);
                    SyntaxBundle bundle =
                        new SyntaxSpecLoader().loadSyntax(new XMLSyntaxSpecAdapter(xml));
                    synMgr.add(bundle);
                } catch (IOException ex) {
                    err.format(err_file_read, alias, ex.getLocalizedMessage());
                } finally {
                    if (reader != null) {
                        reader.close();
                    }
                }
View Full Code Here

    public void execute() throws Exception {
        PrintWriter out = getError().getPrintWriter();
        boolean debug = argDebug.isSet();
        int threadId = argThreadID.getValue();
        if (debug) {
            out.format(fmt_prep_kill, threadId);
        }
        // In order to kill the thread, we need to traverse the thread group tree, looking
        // for the thread whose 'id' matches the supplied one.  First, find the tree root.
        ThreadGroup grp = Thread.currentThread().getThreadGroup();
        while (grp.getParent() != null) {
View Full Code Here

            out.println(threadId);
            // FIXME ... this is bad.  Killing a thread this way could in theory bring down the
            // entire system if we do it at a point where the application thread is executing
            // a method that is updating OS data structures.
            t.stop(new ThreadDeath());
            out.format(fmt_killed, threadId);
        } else {
            out.format(fmt_not_found, threadId);
            exit(1);
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.