Package java.io

Examples of java.io.FileReader


  private void updateJoramAdminXml(String hostName,
                                   String port)
    throws Exception {
    File file = new File(confDir, JORAMADMIN_XML);
    FileReader fileReader = new FileReader(file);
    BufferedReader reader = new BufferedReader(fileReader);
    boolean end = false;
    String line;
    StringBuffer buff = new StringBuffer();
    int i = -1;
View Full Code Here


   */
  private void updateRAR(String raProperties, boolean updateA3servers) throws Exception {
    if (debug)
      System.out.println("RAConfig.updateRAR(" + raProperties + ")");

    FileReader file = new FileReader(raProperties);
    LineNumberReader lnr = new LineNumberReader(file);

    // get RAR name
    String line = lnr.readLine();
    while (line != null) {
      if (line.startsWith("RAR_NAME"))
        break;
      line = lnr.readLine();
    }
    int i = line.indexOf("RAR_NAME");
    String rarName = line.substring(i+"RAR_NAME".length()).trim();
    if (debug)
      System.out.println("RAConfig.updateRAR : rarName = " + rarName);
    else if (verbose)
      System.out.println("update rar \"" + rarName +
                         "\" with \"" + raProperties + "\"");

    // create Map of properties
    Map map = new Hashtable();
    Hashtable prop = null;
    String nodeName = null;
    line = lnr.readLine();
    while (line != null) {
      if (line.startsWith("[")) {
        prop = new Hashtable();
        nodeName = line.substring(line.indexOf("[")+1,line.indexOf("]"));
        map.put(nodeName.trim(),prop);
      } else {
        StringTokenizer st = new StringTokenizer(line);
        if (st.countTokens() == 2 && prop != null) {
          prop.put(st.nextToken(),st.nextToken());
        }
      }
      line = lnr.readLine();
    }
    file.close();

    if (debug)
      System.out.println("RAConfig.updateRAR : map = " + map);

    // create ra.xml file with new values
View Full Code Here

    File cfgFile = new File(path);
    try {
      if (!cfgFile.exists() || !cfgFile.isFile() || (cfgFile.length() == 0)) {
        throw new IOException();
      }
      reader = new FileReader(cfgFile);
    } catch (IOException exc) {
      // configuration file seems not exist, search it from the
      // search path used to load classes.
      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG,
View Full Code Here

  public static Acme.WildcardDictionary parseThrottleFile(String filename) throws IOException {
    Acme.WildcardDictionary wcd = new Acme.WildcardDictionary();
    File thFile = new File(filename);
    if (thFile.isAbsolute() == false)
      thFile = new File(System.getProperty("user.dir", "."), thFile.getName());
    BufferedReader br = new BufferedReader(new FileReader(thFile));
    while (true) {
      String line = br.readLine();
      if (line == null)
        break;
      int i = line.indexOf('#');
View Full Code Here

  public void restoreSessions(ServletContext servletContext) {
    File store = sessions == null?null:getPersistentFile(servletContext);
    if (store != null && store.exists()) {
      BufferedReader bfr = null;
      try {
        bfr = new BufferedReader(new FileReader(store));

        AcmeSession session;
        while ((session = AcmeSession.restore(bfr,
            Math.abs(expiredIn) * 60, servletContext, sessions)) != null)
          if (session.checkExpired() == false)
View Full Code Here

    keepAliveCleaner.start();
    File fsessions = getPersistentFile();
    if (fsessions != null && fsessions.exists()) {
      BufferedReader br = null;
      try {
        br = new BufferedReader(new FileReader(fsessions));
        sessions = HttpSessionContextImpl.restore(br,
            Math.abs(expiredIn) * 60, this);
      } catch (IOException ioe) {
        log("TJWS: IO error in restoring sessions.", ioe);
      } catch (Exception e) {
View Full Code Here

    public void readDefaultHeaderFile() {
        if(_defaultHeaderFile.exists()){
            BufferedReader breader = null;
            try {
                breader = new BufferedReader(new FileReader(_defaultHeaderFile));
                StringBuffer sb = new StringBuffer();
   
                String tmp;
                do {
                    tmp = breader.readLine();
View Full Code Here

 
  public static void main(String[] args) throws IOException {
    Reader reader = null;
    Writer writer = null;
    try {
      reader = new FileReader(new File("/home/tbinias/eclipse/plugin-dev/WGAEclipseEditors/resources/wga/tmlTagDefinitionsXStream.xml"));
      TMLTagDefinitions def = TMLTagDefinitions.fromXML(reader);
      def.getTagByName("item").getValidators().add("de.innovationgate.test");
      writer = new FileWriter(new File("/tmp/defout.xml"));
      def.toXML(def, writer);
    } finally {
View Full Code Here

        if (resultsFile != null) {
            resultsOutputStream = new FileOutputStream(resultsFile);
        }
        BufferedReader expectedResultsReader = null;
        if (expectedResultsFile != null && expectedResultsFile.exists() && expectedResultsFile.canRead()) {
            expectedResultsReader = new BufferedReader(new FileReader(expectedResultsFile));
        }
        return writeAndCompareUpdateCount(updateCount, resultsOutputStream, expectedResultsReader, printToConsole ? System.out : null);
    }
View Full Code Here

        if (resultsFile != null) {
            resultsOutputStream = new FileOutputStream(resultsFile);
        }
        BufferedReader expectedResultsReader = null;
        if (expectedResultsFile != null && expectedResultsFile.exists() && expectedResultsFile.canRead()) {
            expectedResultsReader = new BufferedReader(new FileReader(expectedResultsFile));
        }
        return writeAndCompareBatchedUpdateCounts(counts, resultsOutputStream, expectedResultsReader, printToConsole ? System.out : null);
    }
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.