Package java.io

Examples of java.io.LineNumberReader


     
      Map<String, String> map = new HashMap<String, String>();
      mimeTypeMap = Collections.unmodifiableMap(map);
     
      InputStreamReader isr = null;
      LineNumberReader lnr = null;
      try {
        isr = new InputStreamReader(HttpUtils.class.getResourceAsStream("/org/xlightweb/mime.types"));
        if (isr != null) {
          lnr = new LineNumberReader(isr);
          String line = null;
          while (true) {
            line = lnr.readLine();
            if (line != null) {
              line = line.trim();
              if (!line.startsWith("#")) {
                StringTokenizer st = new StringTokenizer(line);
                if (st.hasMoreTokens()) {
                  String mimeType = st.nextToken();
                  while (st.hasMoreTokens()) {
                    String extension = st.nextToken();
                    map.put(extension, mimeType);
                     
                    if (LOG.isLoggable(Level.FINER)) {
                      LOG.finer("mapping " + extension + " -> " + mimeType + " added");
                    }
                  }
                } else {
                  if (LOG.isLoggable(Level.FINE)) {
                    LOG.fine("line " + line + "ignored");
                 
                }
              }
            } else {
              break;
            }
          }
   
          lnr.close();
        }
       
      } catch (Exception ioe) {
          // eat and log exception
        if (LOG.isLoggable(Level.FINE)) {
          LOG.fine("could not read mime.types. reason: " + ioe.toString());
        }       
       
      } finally {
        try {
          if (lnr != null) {
            lnr.close();
          }
           
          if (isr != null) {
            isr.close();
          }
View Full Code Here


   
    implementationVersion = "<unknown>";
    implementationDate = "<unknown>";
     
    InputStreamReader isr = null;
    LineNumberReader lnr = null;
   
    try {
      isr = new InputStreamReader(HttpUtils.class.getResourceAsStream("/org/xlightweb/version.txt"));
      if (isr != null) {
        lnr = new LineNumberReader(isr);
        String line = null;
   
        do {
          line = lnr.readLine();
          if (line != null) {
            if (line.startsWith("Implementation-Version=")) {
              implementationVersion = line.substring("Implementation-Version=".length(), line.length()).trim();
             
            } else if (line.startsWith("Implementation-Date=")) {
              implementationDate = line.substring("Implementation-Date=".length(), line.length()).trim();
             
            } else if (line.startsWith("Dependency.xSocket.Implementation-Version=")) {
                            xSocketImplementationVersion = line.substring("Dependency.xSocket.Implementation-Version=".length(), line.length()).trim();
                        }
          }
        } while (line != null);
       
        lnr.close();
      }
    } catch (Exception ioe) {
       
            implementationDate = "<unknown>";
            implementationVersion  = "<unknown>";
            xSocketImplementationVersion  = "<unknown>";
                   
      if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("could not read version file. reason: " + ioe.toString());
      }       
     
    } finally {
      try {
        if (lnr != null) {
          lnr.close();
        }
         
        if (isr != null) {
          isr.close();
        }
View Full Code Here

    FileChannel fc = raf.getChannel();
    response.getBlockingBody().transferTo(fc);
    fc.close();
    raf.close();

    LineNumberReader lnr = new LineNumberReader(new FileReader(file));
    String line = lnr.readLine();
   
    Assert.assertEquals("method= GET", line);
   
    file.delete();
    httpClient.close();
View Full Code Here

    StreamingResponseHandler cltHdl = new StreamingResponseHandler(file);
    con.send(new GetRequest("/"), cltHdl);
 
    QAUtil.sleep(1000);
   
    LineNumberReader lnr = new LineNumberReader(new FileReader(file));
 
    Assert.assertEquals("method= GET", lnr.readLine());
   
    file.delete();
    con.close();
    server.close();
  }
View Full Code Here

        }
      transferBuffer.clear();
    }
 
   
    LineNumberReader lnr = new LineNumberReader(new FileReader(file));
    int countLines = 0;
    String lastLine = null;
    String line = null;
   
    do {
      line = lnr.readLine();
      if (line != null) {
        lastLine = line;
        countLines++;
      }
    } while(line != null);
View Full Code Here

    response.getBody().transferTo(fc, length);
    fc.close();
   
 
   
    LineNumberReader lnr = new LineNumberReader(new FileReader(file));
    int countLines = 0;
    String lastLine = null;
    String line = null;
   
    do {
      line = lnr.readLine();
      if (line != null) {
        lastLine = line;
        countLines++;
      }
    } while(line != null);
View Full Code Here

          compile(args[index++]);
        }
       
      } else {
     
        LineNumberReader reader = new LineNumberReader(new InputStreamReader(System.in));
        for(;;) {
          String pathinfo = reader.readLine();
          if (pathinfo == null) {
            break;
          }
          compile(pathinfo);
        }
View Full Code Here

    StreamingResponseHandler cltHdl = new StreamingResponseHandler(file);
    con.send(new GetRequest("/"), cltHdl);
 
    QAUtil.sleep(1000);
   
    LineNumberReader lnr = new LineNumberReader(new FileReader(file));
 
    Assert.assertEquals("method= GET", lnr.readLine());
   
    file.delete();
    con.close();
    server.close();
  }
View Full Code Here

        }
      transferBuffer.clear();
    }
 
   
    LineNumberReader lnr = new LineNumberReader(new FileReader(file));
    int countLines = 0;
    String lastLine = null;
    String line = null;
   
    do {
      line = lnr.readLine();
      if (line != null) {
        lastLine = line;
        countLines++;
      }
    } while(line != null);
View Full Code Here

    response.getBlockingBody().transferTo(fc, length);
    fc.close();
   
 
   
    LineNumberReader lnr = new LineNumberReader(new FileReader(file));
    int countLines = 0;
    String lastLine = null;
    String line = null;
   
    do {
      line = lnr.readLine();
      if (line != null) {
        lastLine = line;
        countLines++;
      }
    } while(line != null);
View Full Code Here

TOP

Related Classes of java.io.LineNumberReader

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.