Package java.io

Examples of java.io.PrintWriter.format()


        } else if (argShow.isSet()) {
            showFlags(VmUtils.getVm().getHeapManager().getHeapFlags(), out);
        } else {
            final Runtime rt = Runtime.getRuntime();
            out.format(fmt_out, str_mem_size, NumberUtils.toBinaryByte(rt.totalMemory()));
            out.format(fmt_out, str_mem_free, NumberUtils.toBinaryByte(rt.freeMemory()));

            out.println(str_start);
            long start = System.currentTimeMillis();
            rt.gc();
            GCStatistics stats = VmUtils.getVm().getHeapManager().getStatistics();
View Full Code Here


            rt.gc();
            GCStatistics stats = VmUtils.getVm().getHeapManager().getStatistics();
            Thread.yield();
            long end = System.currentTimeMillis();

            out.format(fmt_out, str_mem_size, NumberUtils.toBinaryByte(rt.totalMemory()));
            out.format(fmt_out, str_mem_free, NumberUtils.toBinaryByte(rt.freeMemory()));
            out.format(fmt_out, str_time, (end - start) + "ms");
            out.format(fmt_out, str_stats, stats.toString());
        }
    }
View Full Code Here

            GCStatistics stats = VmUtils.getVm().getHeapManager().getStatistics();
            Thread.yield();
            long end = System.currentTimeMillis();

            out.format(fmt_out, str_mem_size, NumberUtils.toBinaryByte(rt.totalMemory()));
            out.format(fmt_out, str_mem_free, NumberUtils.toBinaryByte(rt.freeMemory()));
            out.format(fmt_out, str_time, (end - start) + "ms");
            out.format(fmt_out, str_stats, stats.toString());
        }
    }
View Full Code Here

            Thread.yield();
            long end = System.currentTimeMillis();

            out.format(fmt_out, str_mem_size, NumberUtils.toBinaryByte(rt.totalMemory()));
            out.format(fmt_out, str_mem_free, NumberUtils.toBinaryByte(rt.freeMemory()));
            out.format(fmt_out, str_time, (end - start) + "ms");
            out.format(fmt_out, str_stats, stats.toString());
        }
    }

    private void showFlags(int flags, PrintWriter out) {
View Full Code Here

            long end = System.currentTimeMillis();

            out.format(fmt_out, str_mem_size, NumberUtils.toBinaryByte(rt.totalMemory()));
            out.format(fmt_out, str_mem_free, NumberUtils.toBinaryByte(rt.freeMemory()));
            out.format(fmt_out, str_time, (end - start) + "ms");
            out.format(fmt_out, str_stats, stats.toString());
        }
    }

    private void showFlags(int flags, PrintWriter out) {
        StringBuilder sb = new StringBuilder();
View Full Code Here

        try {
            shell = (CommandShell) ShellUtils.getShellManager().getCurrentShell();
            long start = System.currentTimeMillis();
            ret = shell.runCommand(sb.toString());
            long end = System.currentTimeMillis();
            out.format(fmt_diff, getRuntime((int) (end - start)));
        } catch (ShellException ex) {
            throw ex;
        } finally {
            exit(ret);
        }
View Full Code Here

        try {
            shell = (CommandShell) ShellUtils.getShellManager().getCurrentShell();
            CommandInfo cmdInfo =  shell.getCommandInfo(alias);
            Help cmdHelp = HelpFactory.getHelpFactory().getHelp(alias, cmdInfo);
            if (cmdHelp == null) {
                err.format(err_no_help, alias);
                exit(1);
            }
            cmdHelp.help(out);
            otherAliases(shell.getAliasManager(), alias, cmdInfo.getCommandClass().getName(), out);
        } catch (HelpException ex) {
View Full Code Here

                exit(1);
            }
            cmdHelp.help(out);
            otherAliases(shell.getAliasManager(), alias, cmdInfo.getCommandClass().getName(), out);
        } catch (HelpException ex) {
            err.format(err_help_ex, alias, ex.getLocalizedMessage());
            throw ex;
        } catch (ShellException ex) {
            err.println(ex.getMessage());
            throw ex;
        } catch (SecurityException ex) {
View Full Code Here

            throw ex;
        } catch (ShellException ex) {
            err.println(ex.getMessage());
            throw ex;
        } catch (SecurityException ex) {
            err.format(err_sec_ex, alias, ex.getLocalizedMessage());
            throw ex;
        }
    }
   
    private void otherAliases(AliasManager aliasManager, String thisAlias,
View Full Code Here

    public void execute() throws Exception {
        PrintWriter out = getOutput().getPrintWriter();
        if (shellArg.isSet()) {
            String key = skeyArg.getValue();
            if (!valueArg.isSet()) {
                out.format(fmt_remove, key);
                ShellUtils.getCurrentShell().removeProperty(key);
            } else {
                String value = valueArg.getValue();
                out.format(fmt_set, key, value);
                ShellUtils.getCurrentShell().setProperty(key, value);
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.