java.nio.channels
Class FileLock
java.lang.Object
|
+--java.nio.channels.FileLock
public abstract class
FileLockextends
Object Since:FileLock
protected FileLock(java.nio.channels.FileChannel channel, long position, long size, boolean shared)
Initializes the file lock.
Parameters:
Throws:
channel
public final FileChannel channel()
Returns the file channel upon whose file this lock is held.
isShared
public final boolean isShared()
Tells whether this lock is shared.
isValid
public boolean isValid()
Tells whether or not this lock is valid.
overlaps
public final boolean overlaps(long position, long size)
Tells whether or not this lock overlaps the given lock range.
Parameters:
position
public final long position()
Returns the position within the file of the first byte of the
locked region.
release
public void release()
Releases this lock.
Throws:
size
public final long size()
Returns the size of the locked region in bytes.
toString
public final String toString()
Returns a string describing the range, type, and validity of this lock.