Can I write the end of a 5GB file in Java?
•
Java
Can I write the end of a 5GB file in Java? The question appeared in my office, and no one was sure what the answer was
Solution
This should be easily achieved using RandomAccessFile The following should be valid:
String filename; RandomAccessFile myFile = new RandomAccessFile(filename,"rw"); // Set write pointer to the end of the file myFile.seek(myFile.length()); // Write to end of file here
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码