0

I've been reading on RandomAccessFile and understand that its possible to truncate the end of a file by setLength to a length shorter than the file. Im trying to copy just the "end" of the file to a new file and truncate the beginning.

So for example: I want to delete the first 1300 bytes of a file and copy the rest of the file into a new file.

Is there any way of doing this?

Cheers

1

1 Answer 1

2

Have you considered using the RandomAccessFile seek method to seek to 1300 bytes, and then read the remainder of the file starting at the offset and use another RandomAccessFile (or different stream output) to create a new file with the values you read in from the original file beginning at the 1300 byte offset you specified?

Sign up to request clarification or add additional context in comments.

1 Comment

+1 but this isn't Jeopardy, and the answer doesn't have to be in the form of a question ;-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.