Code example for FileChannel

Methods: mapisOpen

0
	 */ 
	void open() throws IOException { 
		if (source != null)
			return; 
			 
		if (!channel.isOpen())
			throw new IllegalStateException("Channel is closed");
 
		try{ 
			source = new ByteBufferRandomAccessSource(channel.map(FileChannel.MapMode.READ_ONLY, 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