سؤال

I have used Filewriter class. But it will append at the end of the file. Can anyone tell me the method to append the contents to the file at the beginning without overwriting.

هل كانت مفيدة؟

المحلول

You can't, basically. That's not a Java limitation so much as a file system limitation - I can't remember ever seeing an API which allows this.

You'll need to create a new file, write your new data, then append the contents of the original file to it.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top