This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes dataoutputstream and outputstreamwriter class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "dataoutputstream and outputstreamwriter class" Watch "dataoutputstream and outputstreamwriter class" New topic
Author

dataoutputstream and outputstreamwriter class

nagul samy
Ranch Hand

Joined: Feb 15, 2012
Posts: 37
what is the difference between dataoutputstream and outputstreamwriter class in java ??? are both used for converting characters into bytes ???
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7518
    
  18

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


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

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.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dataoutputstream and outputstreamwriter class
 
Similar Threads
OutputStreamReader
unable to preserve newline
I/O quession
What to use regarding streams
I/O package