Code example for FileChannel

Methods: isOpen, map

	void open() throws IOException { 
		if (source != null)
		if (!channel.isOpen())
			throw new IllegalStateException("Channel is closed");
			source = new ByteBufferRandomAccessSource(, offset, length));
		} catch (IOException e){
			if (exceptionIsMapFailureException(e))
				throw new MapFailedException(e);
     * Utility method that determines whether a given IOException is the result 
     * of a failure to map a memory mapped file.  It would be better if the runtime 
     * provided a special exception for this case, but it doesn't, so we have to rely 
     * on parsing the exception message.