wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes DataInputStream 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 » Beginning Java
Bookmark "DataInputStream" Watch "DataInputStream" New topic
Author

DataInputStream

abalfazl hossein
Ranch Hand

Joined: Sep 06, 2007
Posts: 635
the DataInputStream and
DataOutputStream classes are high - level streams that contain methods for reading and writing
the eight Java primitive types as well as String objects



When I deal with a file, I save text there, and read it somewhere.

only text.As C or PHP

What is the usage of save as "primitive types"?

May you show by an example?

Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18501
    
  40

abalfazl hossein wrote:
When I deal with a file, I save text there, and read it somewhere.

only text.As C or PHP

What is the usage of save as "primitive types"?


Not all files need to be text files. It is perfectly valid to save integers, floats, doubles, etc. to a binary file, in their native representation.

Now, of course, if you only believe in using text files, then these methods probably won't ever be used by you.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
jQuery in Action, 2nd edition
 
subject: DataInputStream
 
Similar Threads
trouble with reflection
What IO classes can accept non-Java data types
DataInputStream with Runtime.getRuntime
Input/Output Question...
Please brief on JavaScript architecture