Matlab ftruncate(), Java- JVM, Matlab, java.io.RandomAccessFile Java NIO .
Matlab, Java, n . -.
function remove_last_n_bytes_from_file(file, n)
jFile = java.io.RandomAccessFile(file, 'rw');
currentLength = jFile.length();
wantLength = currentLength - n;
fprintf('Truncating file %s: Resizing to %d to remove %d bytes\n', file, wantLength, n);
jFile.setLength(wantLength);
jFile.close();
.
java.io.RandomAccessFile('/path/to/my/file.bin', 'rw').setLength(n);