What if you tried something like this?
Code:
public void appendToFile() {
FileConnection file;
OutputStream out;
PrintStream writer;
try {
// Open file for writing
file = (FileConnection) Connector.open("file:///test.txt", Connector.WRITE);
out = file.openOutputStream(Long.MAX_VALUE);
writer = new PrintStream(out);
// Append data to file
writer.println("Message");
// Close file connection
writer.close();
out.close();
file.close();
} catch (IOException ex) {
// Handle exception
ex.printStackTrace();
}
}
The parameter passed to openOutputStream() specifies the offset position for writing to the file. Since the offset (should be) larger than the file size, it moves it to the end of the file, allowing you to append to the file instead of overwriting it.
Source:
http://myossdevblog.blogspot.com/200...a-me-j2me.html