Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have only used Java Channels and BufferedOutputStream and the input counter part for reading and writing simple integers and some strings here and there to the file.
However I do not understand the use of all these classes when there is java.util.Scanner class that provides easy ways to read and write to the files.
Java veterans please tell me the use of Channels and Streams over Scanner.

share|improve this question
Have you taken a look at ? – Martijn Verburg Sep 11 '12 at 14:23
For one thing, java.util.Scanner can not be used to write to files. – Michael Borgwardt Sep 11 '12 at 14:25
@MartijnVerburg: Nope, I was using Ivor Horton's book. – Dummy Derp Sep 11 '12 at 14:27
up vote 2 down vote accepted

You use Java Channels for applications that have much more traffic coming to them, not just for simple stuff. Same goes, (kind of) for buffered IO. If you're writing to a file, and you're using any considerable amount of output, then you're going to want to use a buffered IO driver. If you're reading from a file, and don't have to read that much information, use Scanner, otherwise, use buffered IO.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.