I know how to trim a RandomAccess file to remove bytes at the end.
raf.getChannel().truncate(file.length() - 4);
or
raf.setLength(file.length() - 4);
But how to trim the RandomAccessFile so that the bytes at the beginning are deleted? I do not need to write the contents of this file to a new file. I googled and could not find the answer. Please help. Thanks in advance.
source
share