Package java.io

Examples of java.io.FileReader


            System.exit(-1);
         }
        
         String oldFile = args[0];
         String newFile = args[1];
         BufferedReader reader = new BufferedReader(new FileReader(oldFile));
         String line = null;
         StringBuffer buf = new StringBuffer(1024);
         while ( (line = reader.readLine()) != null) {
            buf.append(line).append("\n");
         }
         String oldData = buf.toString();
         reader.close();
         reader = new BufferedReader(new FileReader(newFile));
         buf = new StringBuffer(1024);
         while ( (line = reader.readLine()) != null) {
            buf.append(line).append("\n");
         }
         String newData = buf.toString();
View Full Code Here


  public static String[] readListFromFile(File file) throws RegainException {
    if (!file.exists()) {
      return null;
    }

    FileReader reader = null;
    BufferedReader buffReader = null;
    try {
      reader = new FileReader(file);
      buffReader = new BufferedReader(reader);

      ArrayList list = new ArrayList();
      String line;
      while ((line = buffReader.readLine()) != null) {
        list.add(line);
      }

      String[] asArr = new String[list.size()];
      list.toArray(asArr);

      return asArr;
    } catch (IOException exc) {
      throw new RegainException("Reading word list from " + file.getAbsolutePath()
              + "failed", exc);
    } finally {
      if (buffReader != null) {
        try {
          buffReader.close();
        } catch (IOException exc) {
        }
      }
      if (reader != null) {
        try {
          reader.close();
        } catch (IOException exc) {
        }
      }
    }
  }
View Full Code Here

                            {
                                final File newFile =
                                    new File(buildDirectory,
                                        this.finalName + '.' + FileUtils.getExtension(extractedFile.toString()));
                                extractedFile.renameTo(newFile);
                                String contents = IOUtils.toString(new FileReader(newFile));
                                if (replaceExtensions)
                                {
                                    for (int ctr3 = 0; ctr3 < replacementExtensions.length; ctr3++)
                                    {
                                        final String version = escapePattern(this.project.getVersion());
View Full Code Here

                                            ".*\\\\|/",
                                            "");
                                    this.modelArchiveExcludes.add(shortPath);
                                }
                                extractedFile.renameTo(newFile);
                                String contents = IOUtils.toString(new FileReader(newFile));
                                if (replaceExtensions)
                                {
                                    for (int ctr3 = 0; ctr3 < replacementExtensions.length; ctr3++)
                                    {
                                        final String version = escapePattern(this.project.getVersion());
View Full Code Here

      }
      return ret;
   }
  
   public static MultiThreadSequencer[] createPublishers(String filename) throws IOException {
      BufferedReader reader = new BufferedReader(new FileReader(filename));
      String line = null;
      ArrayList list = new ArrayList();
      while ( (line = reader.readLine()) != null) {
         line = line.trim();
         if (line.length() == 0)
View Full Code Here

     * to the data in the file.
     */
    protected void load(File file) throws IOException {
    if (file==null) return;
   
    BufferedReader br = new BufferedReader(new FileReader(file));

    // First line contains variable names
    String variables = br.readLine();
   
    // Parse the variables
View Full Code Here

            Assert.fail("We where given a pid filename " + file + " but could not find it, giving up");
         } // end of if ()
        
         Thread.sleep(2000);
         } // end of while ()
         BufferedReader r = new BufferedReader(new FileReader(file));
         pid = r.readLine();
      } // end of if ()

      osName = System.getProperty("os.name");
View Full Code Here

      if (sURI.startsWith("file://")) {
        File oXMLFile = new File(sURI.substring(7));
        if (!oXMLFile.exists()) throw new FileNotFoundException("DOMDocument.parseURI(" + sURI.substring(7) + ") file not found");
        if (null==sEncoding) {
          if (DebugFile.trace) DebugFile.writeln("new FileReader(" + sURI.substring(7) + ")");
          oReader = new FileReader(oXMLFile);
          if (DebugFile.trace) DebugFile.writeln("DOMParserWrapper.parse([InputSource])");
        } else {
          oReader = new InputStreamReader(new FileInputStream(oXMLFile), sEncoding);
        }
        oDocument = oParserWrapper.parse(new InputSource(oReader));
View Full Code Here

            System.exit(-1);
         }
           
         pool.init(info);
        
         BufferedReader br = new BufferedReader(new FileReader(filename));
         String line = null;
         StringBuffer buf = new StringBuffer();
         while (  (line = br.readLine()) != null)
            buf.append(line).append("\n");
         br.close();
View Full Code Here

            System.exit(-1);
         }
           
         pool.init(info);
        
         BufferedReader br = new BufferedReader(new FileReader(filename));
         String line = null;
         StringBuffer buf = new StringBuffer();
         while (  (line = br.readLine()) != null)
            buf.append(line).append("\n");
         br.close();
View Full Code Here

TOP

Related Classes of java.io.FileReader

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.