public synchronized void write(long fileOffset, ByteBuffer srcBuf) throws IOException {
int len = srcBuf.remaining();
if (getFileSystem().isReadOnly()) {
throw new ReadOnlyFileSystemException("write in readonly filesystem");
}
final long max = (isDir) ? getLengthOnDisk() : getLength();
if (fileOffset > max) {
throw new IOException("Cannot write beyond the EOF");