Both DataOutputStream and PrintStream do basically the same thing - convert primitive types and Strings to bytes before writing them (writeUTF() is an exception). Why different classes ?
daudiam
-6
Junior Poster
Recommended Answers
Jump to PostDataOutputStream outputs data in its raw binary form - eg always 4 bytes for an int
PrintStream outputs data in a human-readable character format - so an int could be anything such as "0" or "-1234567"
Jump to PostYes (except that ints in Java are 4 bytes, 0x00000002)
All 6 Replies
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
daudiam
-6
Junior Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
daudiam
-6
Junior Poster
hajjanmu
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.