aspose file tools*
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 Spring in Action this week in the Spring 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: 18896
    
  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)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DataInputStream