Java IO package - What is RandomAccessFile and how to use it

RandomAccessFile This allows you to read from it or write to it as you please. You can replace the content of the file. This cannot achieve by FileInputStream or FileOutputStream. Create a RandomAccessFile object RandomAccessFile file = new RandomAccessFile("file.txt", "rw"); Mode Description r Read mode. Calling write methods will result in an IOException. rw Read and write mode rwd Read and write mode - synchronously. All updates to file content is written to the disk synchronously....

December 4, 2022 · 1 min · Derry