79661445

Date: 2025-06-11 05:54:23
Score: 0.5
Natty:
Report link

You can also use RandomAccessFile:

try (final RandomAccessFile raf = new RandomAccessFile("fileToTruncate", "rw")) {
    final long size = raf.length();
    if (size > 0) {
        raf.setLength(size - 1);   
    }
} catch (final IOException ignored) {
  
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Leponzo