Package java.io

Examples of java.io.PrintWriter


        FileWriter writer = null;
        try {
            File f = new File(getBaseDir() + "/" + TRACE_FILE_NAME);
            f.getParentFile().mkdirs();
            writer = new FileWriter(f, true);
            PrintWriter w = new PrintWriter(writer);
            s = dateFormat.format(new Date()) + ": " + s;
            w.println(s);
            if (e != null) {
                e.printStackTrace(w);
            }
        } catch (IOException e2) {
            e2.printStackTrace();
View Full Code Here


    this.actor = actor;
    this.detail = detail;
    if(th != null){
      detail.put("message", th.getMessage());
      StringWriter stringWriter = new StringWriter();
      PrintWriter pw = new PrintWriter(stringWriter );
      th.printStackTrace(pw);
      if(th.getCause() != null){
        th.getCause().printStackTrace(pw);
        if(th.getCause() != null){
          th.getCause().printStackTrace(pw);
        }
      }
      pw.close();
      detail.put("printStackTrace", stringWriter.toString());
    }
  }
View Full Code Here

            }
            catch (IOException e) {
                Plugin.getDefault().logError("Can not create file at : " + _defaultHeaderFile.getAbsolutePath(), e);
            }
        }
            PrintWriter writer;
            try {
                writer = new PrintWriter(_defaultHeaderFile);
                writer.println(_defaultHeader);
                writer.close();
            }
            catch (FileNotFoundException e) {
                Plugin.getDefault().logError("File not found : " + _defaultHeaderFile.getAbsolutePath(), e);
            }       
    }
View Full Code Here

            return "boolean: " + this.bool;
        case INT:
            return "int: " + this.intValue;
        case EXCEPTION: {
            StringWriter w = new StringWriter();
            exception.printStackTrace(new PrintWriter(w));
            return "exception: " + exception.getSQLState() + ": " + exception.getMessage() + "\r\n" + w.toString();
        }
        case RESULT_SET:
            String result = "ResultSet { // size=" + rows.size() + "\r\n  ";
            for (Column column : header) {
View Full Code Here

  return;

    try {
  LayoutEngine le = null;
  if (I18N.get("ExportWin.le_comma").equals(choice))
      le = new CharSepLE(new PrintWriter(new FileWriter(path)), ',');
  else if (I18N.get("ExportWin.le_tab").equals(choice))
      le = new CharSepLE(new PrintWriter(new FileWriter(path)), '\t');
  else if (I18N.get("ExportWin.le_docbook").equals(choice))
      le = new DocBookLE(new PrintWriter(new FileWriter(path)));
  else if (I18N.get("ExportWin.le_html").equals(choice))
      le = new HTMLLE(new PrintWriter(new FileWriter(path)));
  else if (I18N.get("ExportWin.le_latex").equals(choice))
      le = new LaTeXLE(new PrintWriter(new FileWriter(path)));
  else if (I18N.get("ExportWin.le_pdf").equals(choice))
      le = new PDFLE(new FileOutputStream(path));
  else if (I18N.get("ExportWin.le_xml").equals(choice))
      le = new XMLLE(new XMLWriter(new FileOutputStream(path)));
  else if (I18N.get("ExportWin.le_xls").equals(choice))
      le = new ExcelLE(new FileOutputStream(path),false);
  else if (I18N.get("ExportWin.le_csshtml").equals(choice))
      le = new CSSHTMLLE(new PrintWriter(new FileWriter(path)));

  if (le != null) {
      report.setLayoutEngine(le);
      report.run();
  }
View Full Code Here

 

  public NTFileGraph(File file)
      throws IOException {
    super(ReificationStyle.Standard);
    fileWriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file, true), "ascii"));
    if (file.exists()) {
      Model model = ModelFactory.createModelForGraph(this);
      new NonSkoNTripleReader().read(model, file.toURL().toString());
   
    created = true;
View Full Code Here

    System.out.println("Usage:");
    System.out.print(invocationString);
    System.out.print(' ');
    System.out.println(AnnotatedInterfaceArguments
        .getArgumentsSyntax(getArgumentsClass()));
    PrintWriter out = new PrintWriter(System.out, true);
    AnnotatedInterfaceArguments.printArgumentDescriptions(
        getArgumentsClass(), out);
    out.flush();
  }
View Full Code Here

        }
    }

    public void testGetLogWriter() {
        try {
            final PrintWriter actual = new PrintWriter( new ByteArrayOutputStream() );
            dataSource.setLogWriter(actual);
            final PrintWriter result = dataSource.getLogWriter();
            assertEquals(result,actual);
        } catch ( SQLException e ) {
            fail("Error obtaining login timeout"); //$NON-NLS-1$
        }
    }
View Full Code Here

        objects.clear();
    }

    private void printError(int seed, int id, Throwable t) {
        StringWriter writer = new StringWriter();
        t.printStackTrace(new PrintWriter(writer));
        String s = writer.toString();
        TestBase.logError("new TestCrashAPI().init(test).testCase(" +
                seed + "); // Bug " + s.hashCode() + " id=" + id +
                " callCount=" + callCount + " openCount=" + openCount +
                " " + t.getMessage(), t);
View Full Code Here

        // Create two scripts that we will run via "INIT"
        IOUtils.createDirs(init1);

        Writer w = new OutputStreamWriter(IOUtils.openFileOutputStream(init1, false));

        PrintWriter writer = new PrintWriter(w);
        writer.println("create table test(id int identity, name varchar);");
        writer.println("insert into test(name) values('cat');");
        writer.close();

        w = new OutputStreamWriter(IOUtils.openFileOutputStream(init2, false));
        writer = new PrintWriter(w);
        writer.println("insert into test(name) values('dog');");
        writer.close();

        // Make the database connection, and run the two scripts
        deleteDb("initDb");
        Connection conn = getConnection("initDb;" +
                "INIT=" +
View Full Code Here

TOP

Related Classes of java.io.PrintWriter

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.