Java.Nio.Channels.FileChannel.Lock Method
Obtains an exclusive lock on this file.

Syntax

[Android.Runtime.Register("lock", "()Ljava/nio/channels/FileLock;", "")]
public FileLock Lock ()

Returns

Documentation for this section has not yet been entered.

Exceptions

TypeReason
Java.Nio.Channels.ClosedChannelExceptionthe file channel is closed.
Java.Nio.Channels.NonWritableChannelExceptionthis channel was not opened for writing.
Java.Nio.Channels.OverlappingFileLockExceptioneither a lock is already held that overlaps this lock request, or another thread is waiting to acquire a lock that will overlap with this request.
Java.Nio.Channels.FileLockInterruptionExceptionthe calling thread was interrupted while waiting to acquire the lock.
Java.Nio.Channels.AsynchronousCloseExceptionthe channel was closed while the calling thread was waiting to acquire the lock.
Java.IO.IOExceptionif another I/O error occurs while obtaining the requested lock.

Remarks

Obtains an exclusive lock on this file.

This is a convenience method for acquiring a maximum length lock on a file. It is equivalent to: fileChannel.lock(0L, Long.MAX_VALUE, false);

[Android Documentation]

Requirements

Namespace: Java.Nio.Channels
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1