/** * Delegates to {@link FileChannel} * * @see FileChannel#write(ByteBuffer, long) */ public int write(ByteBuffer src, long position) throws IOException { return getFileChannel().write(src, position); }
/** * Delegates to {@link FileChannel} * * @see FileChannel#read(ByteBuffer, long) */ public int read(ByteBuffer dst, long position) throws IOException { return getFileChannel().read(dst, position); }
/** * Delegates to {@link FileChannel} * * @see FileChannel#read(ByteBuffer) */ public int read(ByteBuffer dst) throws IOException { return getFileChannel().read(dst); }
/** * Delegates to {@link FileChannel} * * @see FileChannel#write(ByteBuffer) */ public int write(ByteBuffer src) throws IOException { return getFileChannel().write(src); }
public void truncate(long size) throws IOException { getFileChannel().truncate(size); }
public long size() throws IOException { return getFileChannel().size(); }
/** * Only truncate if the size of the file is less than the size argument. * * @param size * @return true if truncation was performed. */ public boolean truncateIfSmaller(long size) throws IOException { FileChannel fc = getFileChannel(); if (fc.size() < size) { return false; } else { fc.truncate(size); return true; } } }