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

What is the difference between stream-based Input and Channel-Based Input? The java API provides both stream-based in "" package and channel-based in "java.nio" package. Which one of the two is better in performance and reduced run-time errors?

share|improve this question
did you check the 'nio' tag wiki at Stack Overflow? "NIO stands for 'New I/O'. It was introduced in JDK 1.4 in the java.nio package. It comprises several elements:..." – gnat Jun 14 '12 at 15:07
this is a good question, 10 years ago ... the short answer is it depends, there is plenty of extensive documentation on when to use which technology, both are still around because they a better at different things. Long answer Google has everything you need to know. – Jarrod Roberson Jun 14 '12 at 15:47
I think that this serves as a good gateway question. The OP is one of today's lucky 10,000. – Gary Rowe Jun 15 '12 at 12:10
According to - channel is message oriented while stream is byte oriented, and probably does not know how to divide the messages. Another difference, that channels store messages while streams don't. – inf3rno Aug 6 '14 at 20:59
up vote 7 down vote accepted

See this Oracle blog post for a good overview

Also don't neglect to read up on Java 7's NIO.2 APIs!

In terms of performance etc, well the answer is, "it depends". It depends on the characteristics of your I/O, e.g. it's size, it's 'shape', whether it's Network or disc or in memory or ....

share|improve this answer
thanks! I got what I was looking for in that post – Pranit Bauva Jun 14 '12 at 16:32

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.