Tabnine Logo
BufferedReader.ready
Code IndexAdd Tabnine to your IDE (free)

How to use
ready
method
in
java.io.BufferedReader

Best Java code snippets using java.io.BufferedReader.ready (Showing top 20 results out of 3,663)

Refine searchRefine arrow

  • BufferedReader.readLine
  • BufferedReader.<init>
  • InputStreamReader.<init>
  • BufferedReader.close
  • PrintStream.println
  • FileReader.<init>
origin: stackoverflow.com

BufferedReader br = new BufferedReader(new InputStreamReader(System.in, Charset.forName("ISO-8859-1")),1024);
 // ...
    // inside some iteration / processing logic:
    if (br.ready()) {
      int readCount = br.read(inputData, bufferOffset, inputData.length-bufferOffset);
    }
origin: spotbugs/spotbugs

  String falsePositive(BufferedReader r) throws IOException {
    if (!r.ready())
      return "";
    return r.readLine().trim();
  }
}
origin: stackoverflow.com

 private void loadCommands(String fileName) {
  BufferedReader br = null;
  try {
    br = new BufferedReader(new FileReader(fileName));

    while (br.ready()) {
      actionList.add(CommandFactory.GetCommandFromText(this, br.readLine()));
    }
  } catch (FileNotFoundException e) {
    e.printStackTrace();
  } catch (IOException e) {
    e.printStackTrace();
  } finally {
    if (br != null) try { br.close(); } catch (IOException logOrIgnore) {}
  }       
}
origin: jersey/jersey

private static List<JavaFile> getJavaFiles(File configFile) throws Exception {
  final List<JavaFile> javaFiles = new LinkedList<>();
  try (BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(configFile), "UTF-8"))) {
    while (r.ready()) {
      final String className = r.readLine();
      if (!className.startsWith("#")) {
        javaFiles.add(new JavaFile(className, SRC_MAIN_JAVA));
        LOGGER.info(String.format(" + included class %s.\n", className));
      } else {
        LOGGER.info(String.format(" - ignored class %s\n", className.substring(1)));
      }
    }
  }
  return javaFiles;
}
origin: huaban/jieba-analysis

public void loadUserDict(Path userDict, Charset charset) {                
  try {
    BufferedReader br = Files.newBufferedReader(userDict, charset);
    long s = System.currentTimeMillis();
    int count = 0;
    while (br.ready()) {
      String line = br.readLine();
      String[] tokens = line.split("[\t ]+");
      if (tokens.length < 1) {
        // Ignore empty line
        continue;
      }
      String word = tokens[0];
      double freq = 3.0d;
      if (tokens.length == 2)
        freq = Double.valueOf(tokens[1]);
      word = addWord(word); 
      freqs.put(word, Math.log(freq / total));
      count++;
    }
    System.out.println(String.format(Locale.getDefault(), "user dict %s load finished, tot words:%d, time elapsed:%dms", userDict.toString(), count, System.currentTimeMillis() - s));
    br.close();
  }
  catch (IOException e) {
    System.err.println(String.format(Locale.getDefault(), "%s: load user dict failure!", userDict.toString()));
  }
}
origin: apache/flink

  && (!readConsoleInput || !in.ready())) {
  Thread.sleep(200L);
if (readConsoleInput && in.ready()) {
  String command = in.readLine();
  switch (command) {
    case "quit":
      System.err.println(YARN_SESSION_HELP);
      break;
    default:
      System.err.println("Unknown command '" + command + "'. Showing help:");
      System.err.println(YARN_SESSION_HELP);
      break;
origin: apache/flink

@Test
public void testSortingParallelism4() throws Exception {
  final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
  DataSet<Long> ds = env.generateSequence(0, 1000);
  // randomize
  ds.map(new MapFunction<Long, Long>() {
    Random rand = new Random(1234L);
    @Override
    public Long map(Long value) throws Exception {
      return rand.nextLong();
    }
  }).writeAsText(resultPath)
    .sortLocalOutput("*", Order.ASCENDING)
    .setParallelism(4);
  env.execute();
  BufferedReader[] resReaders = getResultReader(resultPath);
  for (BufferedReader br : resReaders) {
    long cmp = Long.MIN_VALUE;
    while (br.ready()) {
      long cur = Long.parseLong(br.readLine());
      assertTrue("Invalid order of sorted output", cmp <= cur);
      cmp = cur;
    }
    br.close();
  }
}
origin: nutzam/nutz

  br = (BufferedReader)r;
else
  br = new BufferedReader(r);
StringBuilder key = new StringBuilder();
StringBuilder sb = new StringBuilder();
OUT: while (br.ready()) {
  String line = Streams.nextLineTrim(br);
  if (line == null)
    } else {
      key.append(line.substring(2).trim());
      while (br.ready()) {
        line = Streams.nextLineTrim(br);
        if (line == null)
origin: stackoverflow.com

try {
  mPIn = new PipedInputStream(mPOut);
  mReader = new LineNumberReader(new InputStreamReader(mPIn));
} catch (IOException e) {
  cancel(true);
try {
  while (mReader.ready()) {
origin: chewiebug/GCViewer

private String readFile(String fileName) throws IOException {
  try (InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName)) {
    if (in != null) {
      try (BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"))) {
        
        StringBuilder text = new StringBuilder();
        while (reader.ready()) {
          text.append(addHtmlTags(reader.readLine())).append("<br/>");
        }
        
        return text.toString();
      }
    }
    else {
      return "'" + fileName + "' not found";
    }
  }
}

origin: stanfordnlp/CoreNLP

/**
 * Constructs a new stoplist from the contents of a file. It is
 * assumed that the file contains stopwords, one on a line.
 * The stopwords need not be in any order.
 */
public StopList(File list) {
 wordSet = Generics.newHashSet();
 try {
  BufferedReader reader = new BufferedReader(new FileReader(list));
  while (reader.ready()) {
   wordSet.add(new Word(reader.readLine()));
  }
 } catch (IOException e) {
  throw new RuntimeException(e);
  //e.printStackTrace(System.err);
  //addGenericWords();
 }
}
origin: GlowstoneMC/Glowstone

try (BufferedReader br = new BufferedReader(new InputStreamReader(is))) {
  if (br.ready()) {
    json = (JSONObject) new JSONParser().parse(br);
  } else {
origin: stanfordnlp/CoreNLP

private static void getWordsFromFile(String filename, Set<String> resultSet, boolean lowercase) throws IOException {
 if(filename==null) {
  return ;
 }
 try (BufferedReader reader = IOUtils.readerFromString(filename)) {
  while(reader.ready()) {
   if(lowercase) resultSet.add(reader.readLine().toLowerCase());
   else resultSet.add(reader.readLine());
  }
 }
}
origin: stanfordnlp/CoreNLP

BufferedReader stdIn = new BufferedReader(
    new InputStreamReader(System.in, charset));
log.info("Input some text and press RETURN to POS tag it, or just RETURN to finish.");
for (String userInput; (userInput = stdIn.readLine()) != null && ! userInput.matches("\\n?"); ) {
 try {
  Socket socket = new Socket(host, port);
  PrintWriter out = new PrintWriter(new OutputStreamWriter(socket.getOutputStream(), charset), true);
  BufferedReader in = new BufferedReader(new InputStreamReader(
      socket.getInputStream(), charset));
  PrintWriter stdOut = new PrintWriter(new OutputStreamWriter(System.out, charset), true);
  stdOut.println(in.readLine());
  while (in.ready()) {
   stdOut.println(in.readLine());
  in.close();
  socket.close();
 } catch (UnknownHostException e) {
stdIn.close();
origin: stanfordnlp/CoreNLP

String stopToken   = "#";
BufferedReader in = new BufferedReader(new FileReader(modelFile));
 in.readLine();
 modelLineCount ++;
String thresholdLine = in.readLine();
modelLineCount ++;
String[] pieces = thresholdLine.split("\\s+");
double threshold = Double.parseDouble(pieces[0]);
while (in.ready()) {
 String svLine = in.readLine();
 modelLineCount ++;
 pieces = svLine.split("\\s+");
in.close();
origin: stanfordnlp/CoreNLP

new Thread(mainWorker).start();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
   if (br.ready()) {
    log.info("received quit command: quitting");
    log.info("training completed by interruption");
origin: stanfordnlp/CoreNLP

private static void getWordsFromFile(String filename, Set<String> resultSet, boolean lowercase) throws IOException {
 if(filename==null) {
  return ;
 }
 try (BufferedReader reader = IOUtils.readerFromString(filename)) {
  while (reader.ready()) {
   if (lowercase) resultSet.add(reader.readLine().toLowerCase());
   else resultSet.add(reader.readLine());
  }
 }
}
origin: marytts/marytts

  BufferedReader in = new BufferedReader(new InputStreamReader(resourceStream, "UTF-8"));
  while (in.ready()) {
    String line = in.readLine();
    listSet.add(line);
  in.close();
  return listSet; // put the set on the map
} else {
origin: apache/geode

 return ("Cannot read logFileName=" + logFileName);
input = new BufferedReader(new FileReader(logFileName));
String line;
File logToBeWrittenToFile = new File(logToBeWritten);
output = new BufferedWriter(new FileWriter(logToBeWrittenToFile));
if (!logToBeWrittenToFile.exists()) {
 input.close();
 output.flush();
 output.close();
 input.close();
 output.flush();
 output.close();
 input.close();
 output.flush();
 output.close();
boolean foundLogLevelTag = false;
boolean validateLogLevel = true;
while (input.ready() && (line = input.readLine()) != null) {
 if (!new File(logFileName).canRead()) {
  return ("Cannot read logFileName=" + logFileName);
origin: igniterealtime/Openfire

  @Override
  public void run() {
    try { 
      if (stdin.ready()) {
        if (EXIT.equalsIgnoreCase(stdin.readLine())) {
          System.exit(0); // invokes shutdown hook(s)
        }
      }
    } catch (IOException ioe) {
      logger.error("Error reading console input", ioe);
    }
  }
}
java.ioBufferedReaderready

Javadoc

Indicates whether this reader is ready to be read without blocking.

Popular methods of BufferedReader

  • <init>
    Creates a buffering character-input stream that uses an input buffer of the specified size.
  • readLine
    Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carr
  • close
    Closes this reader. This implementation closes the buffered source reader and releases the buffer. N
  • read
    Reads characters into a portion of an array. This method implements the general contract of the corr
  • lines
  • reset
    Resets the stream to the most recent mark.
  • mark
    Marks the present position in the stream. Subsequent calls to reset() will attempt to reposition the
  • skip
    Skips characters.
  • markSupported
    Tells whether this stream supports the mark() operation, which it does.
  • checkNotClosed
  • chompNewline
    Peeks at the next input character, refilling the buffer if necessary. If this character is a newline
  • fillBuf
    Populates the buffer with data. It is an error to call this method when the buffer still contains da
  • chompNewline,
  • fillBuf,
  • isClosed,
  • maybeSwallowLF,
  • readChar,
  • fill,
  • ensureOpen,
  • read1

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSystemService (Context)
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • BoxLayout (javax.swing)
  • JButton (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now