Java.Nio.Channels.FileChannel.TryLock Method
Attempts to acquire an exclusive lock on this file without blocking.

Syntax

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

Returns

Documentation for this section has not yet been entered.

Exceptions

TypeReason
Java.Nio.Channels.ClosedChannelExceptionif the file channel is closed.
Java.Nio.Channels.OverlappingFileLockExceptionif a lock already exists that overlaps this lock request or another thread is waiting to acquire a lock that will overlap with this request.
Java.IO.IOExceptionif any I/O error occurs.

Remarks

Attempts to acquire an exclusive lock on this file without blocking.

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

The method returns null if the acquisition would result in an overlapped lock with another OS process.

[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