Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dataoutputstream and outputstreamwriter class

 
nagul samy
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the difference between dataoutputstream and outputstreamwriter class in java ??? are both used for converting characters into bytes ???
 
Winston Gutkowski
Bartender
Pie
Posts: 10527
64
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nagul samy wrote:what is the difference between dataoutputstream and outputstreamwriter class in java ??? are both used for converting characters into bytes ???

The API docs are quite clear about what each class does. What exactly is it you don't understand?

Winston
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15490
43
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java has two kinds of I/O interfaces and classes: streams and readers/writers.

Streams (everything that implements InputStream or OutputStream) are for reading and writing binary data.

Readers and writers are a layer on top of streams for reading and writing text (characters). Readers and writers convert binary data from and to characters using a character encoding.

DataOutputStream is for writing Java objects and values to an underlying OutputStream in binary format. OutputStreamWriter is a writer, for writing text, to an underlying OutputStream.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic