tags:

views:

772

answers:

1

Hi, I'm writing bytes to temp.fls file. After completing the operation, I want to delete the last 256 bytes from the temp.fls file. How can I achieve this? Please help me.

Thanks in advance.

+8  A: 

Use RandomAccessFile.setLength() like so:

RandomAccessFile f = new RandomAccessFile(yourFile,"rw");
f.setLength(f.length()-256);
Stephen Denne
plz give me some sample code
@rekha: spdenne gave you a link to the API documentation. Have a look at it and also at the constructor.
boutta