S
sara
Hi All,
I have a program which generates many lines of data where each line
includes an integer and two floats. I want to know the fastest way to
write these generated lines to a file. Currently, I am writing to a
binary file as follows:
FileOutputStream fos = new FileOutputStream(fileName);
DataOutputStream dos = new DataOutputStream(fos);
for (n : N) {
dos.writeInt(n.id);
dos.writeFloat(x.floatValue());
dos.writeFloat(y.floatValue());
}
However it seems that this approach is very slow. Can I use any kind
of buffering technique to speed up writing to binary file?
Best
Sara
I have a program which generates many lines of data where each line
includes an integer and two floats. I want to know the fastest way to
write these generated lines to a file. Currently, I am writing to a
binary file as follows:
FileOutputStream fos = new FileOutputStream(fileName);
DataOutputStream dos = new DataOutputStream(fos);
for (n : N) {
dos.writeInt(n.id);
dos.writeFloat(x.floatValue());
dos.writeFloat(y.floatValue());
}
However it seems that this approach is very slow. Can I use any kind
of buffering technique to speed up writing to binary file?
Best
Sara