AsynchronousFileChannel.TryLock Method

Definition

Overloads

TryLock()

Attempts to acquire an exclusive lock on this channel's file.

TryLock(Int64, Int64, Boolean)

Attempts to acquire a lock on the given region of this channel's file.

TryLock()

Attempts to acquire an exclusive lock on this channel's file.

[Android.Runtime.Register("tryLock", "()Ljava/nio/channels/FileLock;", "", ApiSince=26)]
public Java.Nio.Channels.FileLock? TryLock ();
[<Android.Runtime.Register("tryLock", "()Ljava/nio/channels/FileLock;", "", ApiSince=26)>]
member this.TryLock : unit -> Java.Nio.Channels.FileLock

Returns

FileLock

A lock object representing the newly-acquired lock, or null if the lock could not be acquired because another program holds an overlapping lock

Attributes

Remarks

Java documentation for java.nio.channels.AsynchronousFileChannel.tryLock().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

TryLock(Int64, Int64, Boolean)

Attempts to acquire a lock on the given region of this channel's file.

[Android.Runtime.Register("tryLock", "(JJZ)Ljava/nio/channels/FileLock;", "GetTryLock_JJZHandler", ApiSince=26)]
public abstract Java.Nio.Channels.FileLock? TryLock (long position, long size, bool shared);
[<Android.Runtime.Register("tryLock", "(JJZ)Ljava/nio/channels/FileLock;", "GetTryLock_JJZHandler", ApiSince=26)>]
abstract member TryLock : int64 * int64 * bool -> Java.Nio.Channels.FileLock

Parameters

position
Int64

The position at which the locked region is to start; must be non-negative

size
Int64

The size of the locked region; must be non-negative, and the sum position&nbsp;+&nbsp;size must be non-negative

shared
Boolean

true to request a shared lock, false to request an exclusive lock

Returns

FileLock

A lock object representing the newly-acquired lock, or null if the lock could not be acquired because another program holds an overlapping lock

Attributes

Remarks

Java documentation for java.nio.channels.AsynchronousFileChannel.tryLock(long, long, boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to