AsynchronousFileChannel.Lock Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Lock() |
Acquires an exclusive lock on this channel's file. |
| Lock(Object, ICompletionHandler) |
Acquires an exclusive lock on this channel's file. |
| Lock(Int64, Int64, Boolean) |
Acquires a lock on the given region of this channel's file. |
| Lock(Int64, Int64, Boolean, Object, ICompletionHandler) |
Acquires a lock on the given region of this channel's file. |
Lock()
Acquires an exclusive lock on this channel's file.
[Android.Runtime.Register("lock", "()Ljava/util/concurrent/Future;", "", ApiSince=26)]
public Java.Util.Concurrent.IFuture? Lock ();
[<Android.Runtime.Register("lock", "()Ljava/util/concurrent/Future;", "", ApiSince=26)>]
member this.Lock : unit -> Java.Util.Concurrent.IFuture
Returns
a Future object representing the pending result
- Attributes
Remarks
Java documentation for java.nio.channels.AsynchronousFileChannel.lock().
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
Lock(Object, ICompletionHandler)
Acquires an exclusive lock on this channel's file.
[Android.Runtime.Register("lock", "(Ljava/lang/Object;Ljava/nio/channels/CompletionHandler;)V", "", ApiSince=26)]
[Java.Interop.JavaTypeParameters(new System.String[] { "A" })]
public void Lock (Java.Lang.Object? attachment, Java.Nio.Channels.ICompletionHandler? handler);
[<Android.Runtime.Register("lock", "(Ljava/lang/Object;Ljava/nio/channels/CompletionHandler;)V", "", ApiSince=26)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "A" })>]
member this.Lock : Java.Lang.Object * Java.Nio.Channels.ICompletionHandler -> unit
Parameters
- attachment
- Object
The object to attach to the I/O operation; can be null
- handler
- ICompletionHandler
The handler for consuming the result
- Attributes
Remarks
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
Lock(Int64, Int64, Boolean)
Acquires a lock on the given region of this channel's file.
[Android.Runtime.Register("lock", "(JJZ)Ljava/util/concurrent/Future;", "GetLock_JJZHandler", ApiSince=26)]
public abstract Java.Util.Concurrent.IFuture? Lock (long position, long size, bool shared);
[<Android.Runtime.Register("lock", "(JJZ)Ljava/util/concurrent/Future;", "GetLock_JJZHandler", ApiSince=26)>]
abstract member Lock : int64 * int64 * bool -> Java.Util.Concurrent.IFuture
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 + size must be non-negative
- shared
- Boolean
true to request a shared lock, in which case this
channel must be open for reading (and possibly writing);
false to request an exclusive lock, in which case this
channel must be open for writing (and possibly reading)
Returns
a Future object representing the pending result
- Attributes
Remarks
Java documentation for java.nio.channels.AsynchronousFileChannel.lock(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
Lock(Int64, Int64, Boolean, Object, ICompletionHandler)
Acquires a lock on the given region of this channel's file.
[Android.Runtime.Register("lock", "(JJZLjava/lang/Object;Ljava/nio/channels/CompletionHandler;)V", "GetLock_JJZLjava_lang_Object_Ljava_nio_channels_CompletionHandler_Handler", ApiSince=26)]
[Java.Interop.JavaTypeParameters(new System.String[] { "A" })]
public abstract void Lock (long position, long size, bool shared, Java.Lang.Object? attachment, Java.Nio.Channels.ICompletionHandler? handler);
[<Android.Runtime.Register("lock", "(JJZLjava/lang/Object;Ljava/nio/channels/CompletionHandler;)V", "GetLock_JJZLjava_lang_Object_Ljava_nio_channels_CompletionHandler_Handler", ApiSince=26)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "A" })>]
abstract member Lock : int64 * int64 * bool * Java.Lang.Object * Java.Nio.Channels.ICompletionHandler -> unit
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 + size must be non-negative
- shared
- Boolean
true to request a shared lock, in which case this
channel must be open for reading (and possibly writing);
false to request an exclusive lock, in which case this
channel must be open for writing (and possibly reading)
- attachment
- Object
The object to attach to the I/O operation; can be null
- handler
- ICompletionHandler
The handler for consuming the result
- Attributes
Remarks
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.