Package java.io

Examples of java.io.PrintStream$Static


  public static void compareResultSet(String testName, ResultSet... rs)
      throws FileNotFoundException, SQLException, IOException {
    FileOutputStream actualOut = null;
        BufferedReader expectedIn = null;
        PrintStream stream = null;
        try {
          if (REPLACE_EXPECTED) {
              File actual = new File(UnitTestUtil.getTestDataPath() + "/" +testName+".expected"); //$NON-NLS-1$ //$NON-NLS-2$
              actualOut = new FileOutputStream(actual);
          } else {
              if (WRITE_ACTUAL_RESULTS_TO_FILE) {
                  File actual = new File(UnitTestUtil.getTestDataPath() + "/" +testName+".actual"); //$NON-NLS-1$ //$NON-NLS-2$
                  actualOut = new FileOutputStream(actual);
              }
              File expected = new File(UnitTestUtil.getTestDataPath() + "/"+testName+".expected"); //$NON-NLS-1$ //$NON-NLS-2$
              expectedIn = new BufferedReader(new FileReader(expected));
          }
          PrintStream defaultStream = null;
          if (PRINT_RESULTSETS_TO_CONSOLE) {
              defaultStream = new PrintStream(System.out) {
                  // SYS.out should be protected from being closed.
                  public void close() {}
              };
          }
          stream = ResultSetUtil.getPrintStream(actualOut, expectedIn, defaultStream);
View Full Code Here


      // the error was due to a thrown exception, and not based comparison issues
      if (resultSet == null) {
    FileOutputStream actualOut = null;
    try {
        actualOut = new FileOutputStream(errorFile);
        PrintStream filePrintStream = new PrintStream(actualOut);
       

        TestResultSetUtil.printThrowable(queryError, sql, filePrintStream);
       
        filePrintStream.flush();

    } catch (Exception e) {
          e.printStackTrace();
          throw new QueryTestFailedException(e);
    } finally {
View Full Code Here

      throws QueryTestFailedException {
 
  FileOutputStream actualOut = null;
  try {
      actualOut = new FileOutputStream(resultsFile);
      PrintStream filePrintStream = new PrintStream(actualOut);
     
      TestResultSetUtil.printResultSet(actualResult, sql, MAX_COL_WIDTH, true, filePrintStream);
         

  } catch (Exception e) {
View Full Code Here

                    // compare with original input document
                    InputStreamReader brdr =
                        new InputStreamReader(new ByteArrayInputStream(bos.toByteArray()), "UTF-8");
                    InputStreamReader frdr = new InputStreamReader(resolver.getContent(), enc);
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    PrintStream pstream = new PrintStream(baos);
                    DocumentComparator comp = new DocumentComparator(pstream);
                    if (comp.compare(frdr, brdr)) {
                       
                        // report schema roundtripped successfully
                        s_logger.debug("Successfully roundtripped schema " + id);
                       
                    } else {
                       
                        // report problems in roundtripping schema
                        s_logger.debug("Errors in roundtripping schema " + id);
                        pstream.flush();
                        s_logger.debug(baos.toString());
                       
                    }
                   
                } catch (XmlPullParserException e) {
View Full Code Here

                    // compare with original input document
                    InputStreamReader brdr =
                        new InputStreamReader(new ByteArrayInputStream(bos.toByteArray()), "UTF-8");
                    InputStreamReader frdr = new InputStreamReader(resolver.getContent(), enc);
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    PrintStream pstream = new PrintStream(baos);
                    DocumentComparator comp = new DocumentComparator(pstream);
                    if (comp.compare(frdr, brdr)) {
                       
                        // report schema roundtripped successfully
                        s_logger.debug("Successfully roundtripped schema " + id);
                       
                    } else {
                       
                        // report problems in roundtripping schema
                        s_logger.debug("Errors in roundtripping schema " + id);
                        pstream.flush();
                        s_logger.debug(baos.toString());
                       
                    }
                   
                } catch (XmlPullParserException e) {
View Full Code Here

    //    new BenchmarkRunner(new MapCache(new LinkedHashMap())),
    public static void main(String[] args) throws Exception
    {

        PrintStream     tsv    = System.out;
        BenchmarkRunner runner = new BenchmarkRunner();

        runner.run(tsv);
    }
View Full Code Here

      if ( part.length > 2 ) System.err.println( "Wrong argument(s) to command" );
      else {
        if ( output != System.out )
          output.close();
        try {
          output = part.length == 1 ? System.out : new PrintStream( new FastBufferedOutputStream( new FileOutputStream( part[ 1 ] ) ) );
        }
        catch ( FileNotFoundException e ) {
          System.err.println( "Cannot create file " + part[ 1 ] );
          output = System.out;
        }
View Full Code Here

      properties.addAll( additionalProperties );
      logger.debug( "Post-merge properties: " + new ConfigurationMap( properties ) );
      properties.save( outputBasename + DiskBasedIndex.PROPERTIES_EXTENSION );
    }
       
    final PrintStream stats = new PrintStream( new FileOutputStream ( outputBasename + DiskBasedIndex.STATS_EXTENSION ) );
    if ( ! metadataOnly ) indexWriter.printStats( stats );
    stats.close();
  }
View Full Code Here

    final SimpleCompressedDocumentCollection simpleCompressedDocumentCollection = new SimpleCompressedDocumentCollection( basenameSuffix, documents, terms.size(), nonTerms != null ? nonTerms.size() : -1, exact, factory );
    BinIO.storeObject( simpleCompressedDocumentCollection, basenameSuffix + DocumentCollection.DEFAULT_EXTENSION );
    simpleCompressedDocumentCollection.close();
   
    final PrintStream stats = new PrintStream( new FileOutputStream ( basenameSuffix + SimpleCompressedDocumentCollection.STATS_EXTENSION ) );
    final long overallBits = bitsForTitles + bitsForUris + bitsForFieldLengths + bitsForWords + bitsForNonWords;
    stats.println( "Documents: " + Util.format( documents ) + " (" + Util.format( overallBits ) + ", " + Util.format( overallBits / (double)documents ) + " bits per document)" );
    stats.println( "Terms: " + Util.format( terms.size() ) + " (" + Util.format( words ) + " words, " + Util.format( bitsForWords ) + " bits, " + Util.format( bitsForWords / (double)words ) + " bits per word)" );
    if ( exact ) stats.println( "Nonterms: " + Util.format( nonTerms.size() ) + " (" + Util.format( words ) + " nonwords, " + Util.format( bitsForNonWords ) + " bits, " + Util.format( bitsForNonWords / (double)words ) + " bits per nonword)" );
    stats.println( "Bits for field lengths: " + Util.format( bitsForFieldLengths ) + " (" + Util.format( bitsForFieldLengths / (double)fields ) + " bits per field)" );
    stats.println( "Bits for URIs: " + Util.format( bitsForUris ) + " (" + Util.format( bitsForUris / (double)documents ) + " bits per URI)" );
    stats.println( "Bits for titles: " + Util.format( bitsForTitles ) + " (" + Util.format( bitsForTitles / (double)documents ) + " bits per title)" );
    stats.close();

  }
View Full Code Here

     * Description of the Method
     *
     * @since
     */
    protected void exportArcs1() {
        PrintStream out = null;
        double lt;
        double ln;
        float ll[];
        int llsize;
        int n;
        File f = chooseFile(1);
        if (arcs == null)
            return;
        if (f == null)
            return;
        try {
            out = new PrintStream(new FileOutputStream(f));
        } catch (IOException e) {
            System.out.println(e);
            return;
        }

        n = arcs.size();
        for (int i = 0; i < n; i++) {
            OMPoly oj = (OMPoly) arcs.getOMGraphicAt(i);
            if (oj == null)
                continue;
            if (!oj.isSelected())
                continue;
            ll = oj.getLatLonArray();
            llsize = ll.length;
            out.println(oj.getLinePaint());
            if ((ll[0] != ll[llsize - 2]) || (ll[1] != ll[llsize - 1]))
                out.print("MetaPolyline: ");
            else {
                llsize -= 2;
                out.print("MetaPolyline: ");
            }
            out.print(llsize / 2);
            Object o = oj.getAppObject();
            if (o != null && o instanceof String)
                System.out.println(o);
            else
                out.println();
            int k = 0;
            while (k < llsize) {
                lt = ll[k++];
                ln = ll[k++];
                out.println(ln + " " + lt);
            }
        }
        out.close();

    }
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.