I have a text file where I want to change only the first line of the file. The file could be millions of rows long, so I'd rather not have to loop over everything, so I'm wondering if there is another way to do this.
I'd also like to apply some rules to the first line so that I replace instances of certain words with other words.
Is this possible?
You want a RandomAccesssFile. Using the file you can read and write wherever you want in the file.
It is much like an InputStream and OutputStream, but it allows reading and writing wherever you like.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With