Package java.io

Examples of java.io.BufferedReader


     * @return length of the <code>CLOB</code> in characters
     */
    public long length() throws SQLException {
      if (len == -1) {
        long length = 0;
        Reader r = new BufferedReader(getCharacterStream());
        try {
        while (r.read() != -1) {
          length++;
        }
      } catch (IOException e) {
        throw new SQLException(e);
      } finally {
        try {
          r.close();
        } catch (IOException e) {
        }
      }
        this.len = length;
      }
View Full Code Here


    /**
     * Get <code>BufferedReader</code>.
     */
    public final static BufferedReader getBufferedReader(Reader reader) {
        BufferedReader buffered = null;
        if (reader instanceof java.io.BufferedReader) {
            buffered = (BufferedReader) reader;
        } else {
            buffered = new BufferedReader(reader);
        }
        return buffered;
    }
View Full Code Here

        return new Object[][] { { "/experiment/zipfgen/zipf-S4000000-L1-R4000000-P10.dat", 64,
                131072 /* 1024 * 1024 / 8 */, 15625 /* 1000000 / 64 */, 20d, 100, 8 } };
    }

    private static long[][] readDistribution(File file, int nthreads, int round) throws IOException {
        BufferedReader reader = new BufferedReader(new FileReader(file));
        long[][] dist = new long[nthreads][];
        for(int th = 0; th < nthreads; th++) {
            long[] curdist = new long[round];
            dist[th] = curdist;
            for(int i = 0; i < round; i++) {
                String line = reader.readLine();
                curdist[i] = Long.parseLong(line.trim());
            }
        }
        IOUtils.closeQuietly(reader);
        return dist;
View Full Code Here

        for(int f = 1; f <= 8; f++) {
            final File file = new File(filename + '.' + f);
            if(!file.exists()) {
                throw new IllegalStateException("File not found: " + filename);
            }
            final BufferedReader reader = new BufferedReader(new FileReader(file));
            for(int j = 0; j < 1000000; j++) {
                String line = reader.readLine();
                dist[i++] = Long.parseLong(line.trim());
            }
            IOUtils.closeQuietly(reader);
        }
        return dist;
View Full Code Here

     *            the character to use for escaping a separator or quote
     * @param strictQuotes
     *            sets if characters outside the quotes are ignored
     */
    public OpenCsvReader(Reader reader, char separator, char quotechar, char escape, boolean strictQuotes) {
        this.br = new BufferedReader(reader);
        this.parser = new OpenCsvParser(separator, quotechar, escape, strictQuotes);
    }
View Full Code Here

        for(int f = 1; f <= 8; f++) {
            final File file = new File(filename + '.' + f);
            if(!file.exists()) {
                throw new IllegalStateException("File not found: " + filename);
            }
            final BufferedReader reader = new BufferedReader(new FileReader(file));
            for(int j = 0; j < 1000000; j++) {
                String line = reader.readLine();
                dist[i++] = Long.parseLong(line.trim());
            }
            IOUtils.closeQuietly(reader);
        }
        return dist;
View Full Code Here

        //return new Object[][] { { "/tmp/zipfgen/1000k_zipf0.86_N50k.dat", 16, 16384, 62500, 20d, 100, 8 } };
        //return new Object[][] { { "/tmp/zipfgen/1000k_zipf0.86_N50k.dat", 8, 16384, 125000, 20d, 100, 8 } };
    }

    private static long[][] readDistribution(File file, int nthreads, int round) throws IOException {
        BufferedReader reader = new BufferedReader(new FileReader(file));
        long[][] dist = new long[nthreads][];
        for(int th = 0; th < nthreads; th++) {
            long[] curdist = new long[round];
            dist[th] = curdist;
            for(int i = 0; i < round; i++) {
                String line = reader.readLine();
                curdist[i] = Long.parseLong(line.trim());
            }
        }
        IOUtils.closeQuietly(reader);
        return dist;
View Full Code Here

        for(int f = 1; f <= 8; f++) {
            final File file = new File(filename + "." + f);
            if(!file.exists()) {
                throw new IllegalStateException("File not found: " + filename);
            }
            final BufferedReader reader = new BufferedReader(new FileReader(file));
            for(int j = 0; j < 1000000; j++) {
                String line = reader.readLine();
                dist[i++] = Long.parseLong(line.trim());
            }
            IOUtils.closeQuietly(reader);
        }
        return dist;
View Full Code Here

  pollForConnectionsSupport(
     final AzureusCore    core )
  {
    bContinue = true;
    while (bContinue) {
      BufferedReader br = null;
      try {
        Socket sck = socket.accept();
        String address = sck.getInetAddress().getHostAddress();
        if (address.equals("localhost") || address.equals("127.0.0.1")) {
          br = new BufferedReader(new InputStreamReader(sck.getInputStream(),Constants.DEFAULT_ENCODING));
          String line = br.readLine();
          //System.out.println("received : " + line);
         
          if (Logger.isEnabled())
            Logger.log(new LogEvent(LOGID, "Main::startServer: received '"
                + line + "'"));
        
          if (line != null) {
            String [] args = parseArgs(line);
            if (args != null && args.length > 0) {
              String debug_str = args[0];
              for (int i=1; i<args.length; i++) {
                debug_str += " ; " + args[i];
              }
              Logger.log(new LogEvent(LOGID, "Main::startServer: decoded to '" + debug_str + "'"));
              processArgs(core,args);
            }
          }
        }
        sck.close();

      }
      catch (Exception e) {
        if(!(e instanceof SocketException))
          Debug.printStackTrace( e );     
        //bContinue = false;
      } finally {
        try {
          if (br != null)
            br.close();
        } catch (Exception e) { /*ignore */
        }
      }
    }
  }
View Full Code Here

            FtpServer server = addUser.getConfiguration(args);
            if (server == null) {
                return;
            }
           
            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
           
            UserManager um = ((DefaultFtpServer)server).getUserManager();
           
            BaseUser user = new BaseUser();
View Full Code Here

TOP

Related Classes of java.io.BufferedReader

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.