Package java.io

Examples of java.io.PrintStream


    }

   
    @Test public void larq_example_1() throws Exception
    {
        PrintStream pOut = System.out ;
        PrintStream pNull = new PrintStream(new ByteArrayOutputStream()) ;
        System.setOut(pNull) ;
        try {
            ExLucene1.main(null) ;
        } finally { System.setOut(pOut) ; }
    }
View Full Code Here


        } finally { System.setOut(pOut) ; }
    }

    @Test public void larq_example_2() throws Exception
    {
        PrintStream pOut = System.out ;
        PrintStream pNull = new PrintStream(new ByteArrayOutputStream()) ;
        System.setOut(pNull) ;
        try {
            ExLucene2.main(null) ;
        } finally { System.setOut(pOut) ; }
    }
View Full Code Here

        } finally { System.setOut(pOut) ; }
    }

    @Test public void larq_example_3() throws Exception
    {
        PrintStream pOut = System.out ;
        PrintStream pNull = new PrintStream(new ByteArrayOutputStream()) ;
        System.setOut(pNull) ;
        try {
            ExLucene3.main(null) ;
        } finally { System.setOut(pOut) ; }
    }
View Full Code Here

        } finally { System.setOut(pOut) ; }
    }

    @Test public void larq_example_4() throws Exception
    {
        PrintStream pOut = System.out ;
        PrintStream pNull = new PrintStream(new ByteArrayOutputStream()) ;
        System.setOut(pNull) ;
        try {
            ExLucene4.main(null) ;
        } finally { System.setOut(pOut) ; }
    }
View Full Code Here

            ExLucene4.main(null) ;
        } finally { System.setOut(pOut) ; }
    }
    @Test public void larq_example_5() throws Exception
    {
        PrintStream pOut = System.out ;
        PrintStream pNull = new PrintStream(new ByteArrayOutputStream()) ;
        System.setOut(pNull) ;
        try {
            ExLucene5.main(null) ;
        } finally { System.setOut(pOut) ; }
    }
View Full Code Here

    }

    private void testTraceDebug() {
        TraceSystem ts = new TraceSystem(null);
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ts.setSysOut(new PrintStream(out));
        ts.setLevelSystemOut(TraceSystem.DEBUG);
        ts.getTrace("test").debug(new Exception("error"), "test");
        ts.close();
        String outString = new String(out.toByteArray());
        assertContains(outString, "error");
View Full Code Here

  public String exception(Throwable t) throws IOException{
    if(t == null)
      return null;
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try{
      t.printStackTrace(new PrintStream(baos));
    }finally{
      baos.close();
    }
    return baos.toString();
  }
View Full Code Here

     * Results are sorted by property name.
     */   
    public static void print( String fileName, Properties props ) throws IOException {

        FileOutputStream stream = null;
        PrintStream writer = null;

        try {

        stream = new FileOutputStream(fileName);
          writer = new PrintStream(stream);
   
            List names = new ArrayList();
            Enumeration enumeration = props.propertyNames();
            while ( enumeration.hasMoreElements() ) {
                String name = (String) enumeration.nextElement();
                names.add(name);
            }
            Collections.sort(names);
   
            StringBuffer sb;
   
            for (Iterator nIt=names.iterator(); nIt.hasNext(); ) {
              String name = (String) nIt.next();
   
              String value = props.getProperty(name);
   
              sb = new StringBuffer();
   
              sb.append(name);
              sb.append("="); //$NON-NLS-1$
              sb.append(value);
   
              writer.println(sb.toString());
            }
            writer.flush();
        } finally {
            try {
                if (writer != null) {
                    writer.close();
                }
            } catch (Exception e){
                               
            }
            try {
View Full Code Here

        deleteDb("script");
        String outFile = "test.out.txt";
        String inFile = fileName;
        conn = getConnection("script");
        stat = conn.createStatement();
        out = new PrintStream(new FileOutputStream(outFile));
        errors = new StringBuilder();
        testFile(inFile);
        conn.close();
        out.close();
        if (errors.length() > 0) {
View Full Code Here

 
 
  FileOutputStream actualOut = null;
  try {
      actualOut = new FileOutputStream(fos);
      PrintStream filePrintStream = new PrintStream(actualOut);
      if (ex != null) {
    TestResultSetUtil.printThrowable(ex, query, filePrintStream);
      } else if (result != null ){
    result.beforeFirst();
    TestResultSetUtil.printResultSet(result, query, MAX_COL_WIDTH, true, filePrintStream);
View Full Code Here

TOP

Related Classes of java.io.PrintStream

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.