*
The moose likes I/O and Streams and the fly likes Data Stream and Byte Stream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Data Stream and Byte Stream" Watch "Data Stream and Byte Stream" New topic
Author

Data Stream and Byte Stream

Candy Bortniker
Ranch Hand

Joined: Mar 17, 2003
Posts: 123
What is the difference between Data stream and Byte stream?
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
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

Joined: Jan 30, 2000
Posts: 18671
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.


"I'm not back." - Bill Harding, Twister
 
GeeCON Prague 2014
 
subject: Data Stream and Byte Stream