Skip to content
Advertisement

Tag: bufferedreader

what are the benefits of BufferedReader over Scanner

here’s a code about depth first search in graphs. who knows why bufferedReader class were used in this code? and why nextInt function not used instead? what is its privilege? is it for speeding up processing? Thanks 🙂 Answer It’s an issue of how you intend to use the stream. A buffered reader exists for simple and threaded applications. This

Closing BufferedReader and System.in

I’ve noticed that if I close the BufferedReader, I won’t be able to insert input from the keyboard anymore, as System.in is somehow closed. Is there anyway I can keep br.close() (I need that in order to delete a file) and then add more input from the keyboard? Answer Looks like you need: http://commons.apache.org/io/apidocs/org/apache/commons/io/input/CloseShieldInputStream.html Wrap that around System.in before making

Advertisement