FileDocCategorySizeDatePackage
FileLockImpl.javaAPI DocAndroid 1.5 API2478Wed May 06 22:41:04 BST 2009org.apache.harmony.nio.internal

FileLockImpl

public final class FileLockImpl extends FileLock

Fields Summary
private boolean
isReleased
Constructors Summary
public FileLockImpl(FileChannel channel, long position, long size, boolean shared)


    /*
     * Returns a new file lock object with the given parameters.
     * 
     * @param channel the file channel hosting the lock. @param position the
     * start position of the lock, in bytes @param size the length of the lock,
     * in bytes @param shared whether this lock is shared (true) or exclusive
     * (false)
     */
          
              
        super(channel, position, size, shared);
    
Methods Summary
public booleanisValid()

        return !isReleased && channel().isOpen();
    
public voidrelease()

        if (!channel().isOpen()) {
            throw new ClosedChannelException();
        }

        if (!isReleased) {
            ((FileChannelImpl) channel()).release(this);
            isReleased = true;
        }