com.faunos.util.io
Class LockProtectedFileChannel

java.lang.Object
  extended by java.nio.channels.spi.AbstractInterruptibleChannel
      extended by java.nio.channels.FileChannel
          extended by com.faunos.util.io.FilterFileChannel
              extended by com.faunos.util.io.LockProtectedFileChannel
All Implemented Interfaces:
Closeable, ByteChannel, Channel, GatheringByteChannel, InterruptibleChannel, ReadableByteChannel, ScatteringByteChannel, WritableByteChannel

public class LockProtectedFileChannel
extends FilterFileChannel

A FilterFileChannel that prevents locking any part of the underlying file channel. Invoking any of the methods overridden in this class raises an UnsupportedOperationException.

Author:
Babak Farhang

Nested Class Summary
 
Nested classes/interfaces inherited from class com.faunos.util.io.FilterFileChannel
FilterFileChannel.FilterFileLock
 
Nested classes/interfaces inherited from class java.nio.channels.FileChannel
FileChannel.MapMode
 
Field Summary
 
Fields inherited from class com.faunos.util.io.FilterFileChannel
inner
 
Constructor Summary
LockProtectedFileChannel(FileChannel inner)
           
 
Method Summary
 FileLock lock(long position, long size, boolean shared)
           
 FileLock tryLock(long position, long size, boolean shared)
           
 
Methods inherited from class com.faunos.util.io.FilterFileChannel
checkReadAccess, checkWriteAccess, force, implCloseChannel, implCreateFileLock, map, position, position, read, read, read, size, transferFrom, transferTo, truncate, write, write, write
 
Methods inherited from class java.nio.channels.FileChannel
lock, read, tryLock, write
 
Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, isOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.nio.channels.Channel
close, isOpen
 
Methods inherited from interface java.nio.channels.Channel
close, isOpen
 
Methods inherited from interface java.nio.channels.Channel
close, isOpen
 
Methods inherited from interface java.nio.channels.Channel
close, isOpen
 

Constructor Detail

LockProtectedFileChannel

public LockProtectedFileChannel(FileChannel inner)
Parameters:
inner -
Method Detail

lock

public FileLock lock(long position,
                     long size,
                     boolean shared)
              throws IOException
Overrides:
lock in class FilterFileChannel
Throws:
IOException

tryLock

public FileLock tryLock(long position,
                        long size,
                        boolean shared)
                 throws IOException
Overrides:
tryLock in class FilterFileChannel
Throws:
IOException


SourceForge.net Logo