@Override public FileChannel truncate(long newLength) throws IOException { if (newLength < size()) { data.touch(readOnly); pos = Math.min(pos, newLength); data.truncate(newLength); } return this; }