Package java.io

Examples of java.io.PrintStream$Static


    String logPath = System.getProperty(LOCAL_LOG_FILE_PROPERTY);
    if (logPath == null) {
      this.printStream = System.out;
    } else {
      try {
        this.printStream = new PrintStream(new File(logPath));
      } catch (FileNotFoundException e) {
        throw new IllegalArgumentException("Log file " + logPath + " was not found", e);
      }
    }
  }
View Full Code Here


    Pattern pattern = Pattern.compile( "\t" );
    Matcher matcher = pattern.matcher( "" );
   
    final int h = jsapResult.getInt( "h" );
    final String basename = jsapResult.getString( "basename" );
    final PrintStream printStream[] = new PrintStream[ h + 1 ];
    for( int i = 0; i <= h; i++ ) printStream[ i ] = new PrintStream( new FastBufferedOutputStream( new FileOutputStream( basename + "-" + i + DiskBasedIndex.STATS_EXTENSION ) ) );
   
    final MutableString line = new MutableString();
    final FastBufferedReader reader = new FastBufferedReader( new InputStreamReader( System.in ) );
   
    int l, start;
View Full Code Here

    private static void verifyBinding(String match, BindingHolder holder) throws Exception {
        StringReader rdr1 = new StringReader(match);
        String gen = bindingText(holder);
        StringReader rdr2 = new StringReader(gen);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        PrintStream pstr = new PrintStream(bos);
        DocumentComparator comp = new DocumentComparator(pstr);
        boolean same = comp.compare(rdr1, rdr2);
        if (!same) {
            pstr.close();
            fail("Generated binding error:\n" + new String(bos.toByteArray()) + "\nGenerated binding:\n" + gen
                + "\nExpected binding:\n" + match);
        }
    }
View Full Code Here

     */
    protected void verifySchema(String text1, String text2) throws Exception {
        StringReader rdr1 = new StringReader(text1);
        StringReader rdr2 = new StringReader(text2);
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        PrintStream pstr = new PrintStream(bos);
        DocumentComparator comp = new DocumentComparator(pstr);
        boolean match = comp.compare(rdr1, rdr2);
        if (!match) {
            pstr.close();
            fail("Error roundtripping schema:\n" + new String(bos.toByteArray()) + "\nOriginal schema:\n" + text1
                + "\nOutput schema:\n" + text2);
        }
    }
View Full Code Here

    public OutputEventRenderer addStandardOutputAndError() {
        TerminalDetector terminalDetector = new TerminalDetector();
        boolean stdOutIsTerminal = terminalDetector.isSatisfiedBy(FileDescriptor.out);
        boolean stdErrIsTerminal = terminalDetector.isSatisfiedBy(FileDescriptor.err);
        if (stdOutIsTerminal) {
            PrintStream outStr = org.fusesource.jansi.AnsiConsole.out();
            Console console = new AnsiConsole(outStr, outStr, colourMap);
            addConsole(console, true, stdErrIsTerminal);
        } else if (stdErrIsTerminal) {
            // Only stderr is connected to a terminal
            PrintStream errStr = org.fusesource.jansi.AnsiConsole.err();
            Console console = new AnsiConsole(errStr, errStr, colourMap);
            addConsole(console, false, true);
        }
        if (!stdOutIsTerminal) {
            addStandardOutput(System.out);
View Full Code Here

        return snapshot;
    }

    private void install() {
        if (original == null) {
            PrintStream originalStream = get();
            original = new PrintStreamDestination(originalStream);
        }
        outstr.flush();
        if (get() != outstr) {
            set(outstr);
View Full Code Here

        System.out.print("no EOL");
        System.out.println();
        System.err.println("This is test stderr");
        Logger.getLogger("test-logger").warning("this is a warning");

        final PrintStream out = System.out;
        // logging from a shutdown hook
        Runtime.getRuntime().addShutdownHook(new Thread() {
            @Override
            public void run() {
                out.println("stdout from a shutdown hook.");
                Logger.getLogger("test-logger").info("info from a shutdown hook.");
            }
        });

        // logging from another thread
View Full Code Here

                tool = new CreateCluster();
            } else {
                throw DbException.throwInternalError(toolName);
            }
            ByteArrayOutputStream outBuff = new ByteArrayOutputStream();
            PrintStream out = new PrintStream(outBuff, false, "UTF-8");
            tool.setOut(out);
            try {
                tool.runTool(argList);
                out.flush();
                String o = new String(outBuff.toByteArray(), "UTF-8");
                String result = PageParser.escapeHtml(o);
                session.put("toolResult", result);
            } catch (Exception e) {
                session.put("toolResult", getStackTrace(0, e, true));
View Full Code Here

            }
        }.execute();
    }

    private void javacSun(File javaFile) {
        PrintStream old = System.err;
        ByteArrayOutputStream buff = new ByteArrayOutputStream();
        PrintStream temp = new PrintStream(buff);
        try {
            System.setErr(temp);
            Method compile = JAVAC_SUN.getMethod("compile", String[].class);
            Object javac = JAVAC_SUN.newInstance();
            compile.invoke(javac, (Object) new String[] {
View Full Code Here

        final SAXWriter writer = new SAXWriter(baos);
        final SAXSerializer ser = new SAXSerializer(writer);
        try {
            dtm.export(0, ser);
        } catch (XQueryException e) {
            PrintUtils.prettyPrintStackTrace(e, new PrintStream(baos));
        }
        return baos.toString();
    }
View Full Code Here

TOP

Related Classes of java.io.PrintStream$Static

Copyright © 2018 www.massapicom. 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.