[java] More Newbie questions: How to handle data in hard disk
I mean, read ''n write to a file. Actually I''m needing to do it with strings and integers, so isn''t there some other way beside using byte reading?
Thanks, Arthur(rockslave)
import money.*;#include "cas.h"uses bucks;
Check out classes like
- java.io.BufferedReader
- java.io.BufferedWriter
- java.lang.StringBuffer
I think there''s FileReader and FileWriter also.
So basically you open an inputstream to the file you want to read for example, wrap a bufferedreader around it and read the file line by line to stringbuffer. No need to mess with bytes.
Just an idea.
''''2+2=5 for extremely large values of 2.''''
- java.io.BufferedReader
- java.io.BufferedWriter
- java.lang.StringBuffer
I think there''s FileReader and FileWriter also.
So basically you open an inputstream to the file you want to read for example, wrap a bufferedreader around it and read the file line by line to stringbuffer. No need to mess with bytes.
Just an idea.
''''2+2=5 for extremely large values of 2.''''
- Fovster
December 20, 2000 01:18 PM
also check out ObjectOutputStream and ObjectInputStream, and interface serializable to go with them. They let you save and load objects directly to and from files.
If you are reading from a file not created by Java then you need to create a filter to change data to byte orientation.
I wanrned you! Didn''t I warn you?! That colored chalk was forged by Lucifer himself!
Opere Citato
I wanrned you! Didn''t I warn you?! That colored chalk was forged by Lucifer himself!
Opere Citato
"... we should have such an empire for liberty as she has never surveyed since the creation ..."Thomas Jefferson
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement