Package java.io

Examples of java.io.FileWriter


    Class[] classes = { TranslatorMetaDataGroup.class };
    JAXBContext context = JAXBContext.newInstance(classes);
    Marshaller marshaller = context.createMarshaller();
    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,new Boolean(true));

    FileWriter fw = null;
    try {
      fw = new FileWriter(dsXml);
      marshaller.marshal(group, fw);
    } finally {
      if (fw != null) {
        fw.close();
      }
    }
  }
View Full Code Here


    WebRobot robby = new WebRobot();
    robby.setStartURL(new URL("http://www.matuschek.net"));
    robby.setMaxDepth(1);
    robby.setSleepTime(0);

    FileWriter logfile = new FileWriter("urls.txt");
    URLLogger log = new URLLogger(logfile);
    robby.setDocManager(log);

    robby.run();
    logfile.close();
  }
View Full Code Here

        return;
      }
    }
   
    File dialogFile = new File(dialogSubDir.toString() + File.separator + dialogName);
    BufferedWriter br = new BufferedWriter(new FileWriter(dialogFile));
    br.write(response + "\n");
    br.flush();
    br.close();
  }
View Full Code Here

        this.file = file;
        open();
    }
   
    protected synchronized void open() throws IOException {
        log = new PrintWriter(new FileWriter(file, true), true);
        closed = false;
    }
View Full Code Here

    if (f1.exists()) {
      Mapping mapping = new Mapping();
      try {
  mapping.loadMapping(mappingfile);
  Writer writer = new FileWriter(filename);
  Marshaller marshaller = new Marshaller(writer);
  marshaller.setMapping(mapping);
  marshaller.marshal(this);
  writer.close();
 
  log.info("written to XML");
      } catch (Exception e) {
  log.error(e.getMessage());
  e.printStackTrace();
View Full Code Here

     * This method writes the solution to a file.
     */
    public void writeToFile(Collection<? extends Event> optTIs, String fileName)
            throws IOException {

        BufferedWriter writer = new BufferedWriter(new FileWriter(fileName + ".sln"));
        logger.debug("Write to file: " + fileName + ".sln");

        try {
            for (Event ti : optTIs) {
                Location r = ti.getLocation();
View Full Code Here

  public static boolean writeToFile(String filename, String message, boolean append) {
    boolean    result;
    BufferedWriter  writer;
   
    try {
      writer = new BufferedWriter(new FileWriter(filename, append));
      writer.write(message);
      writer.newLine();
      writer.flush();
      writer.close();
      result = true;
View Full Code Here

        e.printStackTrace();
        try {
            TraceSystem ts = new TraceSystem(null);
            FileLock lock = new FileLock(ts, "error.lock", 1000);
            lock.lock(FileLock.LOCK_FILE);
            FileWriter fw = new FileWriter("error.txt", true);
            PrintWriter pw = new PrintWriter(fw);
            e.printStackTrace(pw);
            pw.close();
            fw.close();
            lock.unlock();
        } catch (Throwable t) {
            t.printStackTrace();
        }
        System.err.flush();
View Full Code Here

    if (m_LogFile == null)
      return;
   
    // append output to file
    try {
      writer = new BufferedWriter(new FileWriter(m_LogFile, true));
      writer.write(s);
      writer.flush();
      writer.close();
    }
    catch (Exception e) {
View Full Code Here

        // get garbage collected.
        try{
           if (file.exists()) {
               readerWriter = new BufferedReader(new FileReader(file));
           } else {
               readerWriter = new PrintWriter(new FileWriter(file));
           }
           return true;
       } catch (IOException e) {
           setError(e);
           return false;
View Full Code Here

TOP

Related Classes of java.io.FileWriter

Copyright © 2015 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.