Of course, Java IO provides some APIs in this regard.Here, in this article, we shall see one such way where a flat file access mechanism can be customized like a database CRUD operation.
To do that it provides own methods to write primitive Java types in specified number of bytes – for example an integer is written using 4 bytes. Random Access File is a separate class that allows to jump around the file and it doesn’t implement Input Stream nor Output Stream interfaces, so cannot be combined with other stream processing classes from
Although a sequential access mechanism traverses file record in a linear fashion, random access in a file enables us to access individual records directly without searching through other records.
Flat files in general are not meant to be accessed in this manner; moreover, Java does not impose any structure on a file.
If i insert a new dataset, i always append it to the end of the file.
But the number of datasets that could be i n one file is limited.