This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Data Stream and Byte Stream  RSS feed

 
Candy Bortniker
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between Data stream and Byte stream?
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I take you are talking about DataInputStream and ByteArrayInputStream(and corresponding output streams).
Besides having quite different interfaces, the Data streams are used for reading Java primitives, so you are dealing with data in its "natural" form.
Byte streams handles data at the byte level, and stores it in an array. It doesn't deal with the character "C", like a data stream will, it deals with the byte value of "C".
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A byte stream would be any subclass of InputStream or OutputStream. A data stream probably refers to a DataInputStream or DataOutputStream, which are specific kinds of byte streams which contain methods for converting to or from various data types (int, char, String, Object, and others.). See the API for DataInputStream and DataOutputStream for more info, or read about them in an intro Java book.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!