Package java.io

Examples of java.io.LineNumberReader


    _map.clear();
    _nextid = 0;
    FileInputStream in = null;
    try {
      in = new FileInputStream(_index);
      LineNumberReader reader = new LineNumberReader(new InputStreamReader(in));
      for(;;) {
        String str = reader.readLine();
        if (str == null) {
          break;
        }
        if (str.length() == 0) {
          continue;
View Full Code Here


     
      Map<String, String> map = new HashMap<String, String>();
      mimeTypeMap = Collections.unmodifiableMap(map);
     
      InputStreamReader isr = null;
      LineNumberReader lnr = null;
      try {
        isr = new InputStreamReader(ServerUtils.class.getResourceAsStream("/org/xsocket/connection/http/server/mime.types"));
        if (isr != null) {
          lnr = new LineNumberReader(isr);
          String line = null;
          do {
            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");
                 
                }
              }
            }
          } while (line != null);
   
          lnr.close();
        }
      } catch (IOException ioe) {
        if (LOG.isLoggable(Level.FINE)) {
          LOG.fine("Error occured by reding version file " + ioe.toString());
        }
       
      } finally {
        try {
          if (lnr != null) {
            lnr.close();
          }
           
          if (isr != null) {
            isr.close();
          }
View Full Code Here

    FileChannel fc = raf.getChannel();
    response.getBody().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

        QAUtil.sleep(1000);
       
       
        BodyDataSource clientChannel = response.getBody();
        InputStream is = Channels.newInputStream(clientChannel);
        LineNumberReader lnr = new LineNumberReader(new InputStreamReader(is));
       
        StringBuilder sb = new StringBuilder();
        String line = null;
        do {
            line = lnr.readLine();
            if (line != null) {
                sb.append(line + "\r\n");
            }
        } while (line != null);


       
        InputStream is2 = new FileInputStream(file);
        LineNumberReader lnr2 = new LineNumberReader(new InputStreamReader(is2));
       
        StringBuilder sb2 = new StringBuilder();
        String line2 = null;
        do {
            line2 = lnr2.readLine();
            if (line2 != null) {
                sb2.append(line2 + "\r\n");
            }
        } while (line2 != null);
       
View Full Code Here

           
            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

     
      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

     
      Map<String, String> map = new HashMap<String, String>();
      mimeTypeMap = Collections.unmodifiableMap(map);
     
      InputStreamReader isr = null;
      LineNumberReader lnr = null;
      try {
        isr = new InputStreamReader(ServerUtils.class.getResourceAsStream("/org/xsocket/connection/http/server/mime.types"));
        if (isr != null) {
          lnr = new LineNumberReader(isr);
          String line = null;
          do {
            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");
                 
                }
              }
            }
          } while (line != null);
   
          lnr.close();
        }
      } catch (IOException ioe) {
        if (LOG.isLoggable(Level.FINE)) {
          LOG.fine("Error occured by reding version file " + 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();
    server.close();
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.