I know how to truncate a RandomAccess file so that bytes at the end are removed.
raf.getChannel().truncate(file.length() - 4);
or
raf.setLength(file.length() - 4);
But how to truncate a RandomAccessFile in such a way that bytes at the start is removed? I don't need to write contents of this file to a new file. I googled and could not find an answer. Please help. Thanks in advance.