if(getFileSystem().isReadOnly()) { throw new ReadOnlyFileSystemException("write in readonly filesystem"); }
	public synchronized void write(long fileOffset, byte[] src, int srcOfs, int len) throws IOException {		final long max = (isDir) ? getLengthOnDisk() : getLength();		if (fileOffset > max) {			throw new IOException("Cannot write beyond the EOF");		}              if (fileOffset + len > max) { // this is too short increase the size of the file          setLength(fileOffset + len);      }				final FatFileSystem fs = getFatFileSystem();		final long[] chain = fs.getFat().getChain(getStartCluster());		final BlockDeviceAPI api = fs.getApi();		int chainIdx = (int)(fileOffset / clusterSize);		if (fileOffset % clusterSize != 0) {			int clusOfs = (int)(fileOffset % clusterSize);			int size = Math.min(len, (int)(clusterSize - (fileOffset % clusterSize) - 1));			api.write(getDevOffset(chain[chainIdx], clusOfs), src, srcOfs, size);			fileOffset += size;			len -= size;			srcOfs += size;			chainIdx++; 		}		while (len > 0) {			int size = Math.min(clusterSize, len);			api.write(getDevOffset(chain[chainIdx], 0), src, srcOfs, size);			len -= size;			srcOfs += size;			chainIdx++;		}		}