Saturday, February 10, 2007

How can I write primitive data-types to disk? In C/C++, the printf statement could write integers, floats, as well as other types.

Writing primitive data-types can be easily done, using the DataOutputStream class. DataOutputStream provides simple methods to write primitive data-types out to any output stream, whether it be the user console, a network connection, or a file.
Java also provides a corresponding DataInputStream, which will allow you to read data back. This means you can write a data structure out to a disk or network connection, and read it back at a later date.


SOURCE : www.referjava.com

No comments: