Class IoAPI


  • @Include("IoAPI.h")
    public final class IoAPI
    extends Object
    Wrapper around the IoAPI.h header.
    Author:
    aploese
    • Field Detail

      • HAVE_IOAPI_H

        public static final boolean HAVE_IOAPI_H
    • Constructor Detail

      • IoAPI

        public IoAPI()
    • Method Detail

      • CreateIoCompletionPort

        public static Winnt.HANDLE CreateIoCompletionPort​(Winnt.HANDLE FileHandle,
                                                          Winnt.HANDLE ExistingCompletionPort,
                                                          long CompletionKey,
                                                          int NumberOfConcurrentThreads)
                                                   throws NativeErrorException
        CreateIoCompletionPort Creates an input/output (I/O) completion port and associates it with a specified file handle, or creates an I/O completion port that is not yet associated with a file handle, allowing association at a later time.
        Parameters:
        FileHandle - An open file handle or INVALID_HANDLE_VALUE.
        ExistingCompletionPort - A handle to an existing I/O completion port or NULL.
        CompletionKey - The per-handle user-defined completion key that is included in every I/O completion packet for the specified file handle.
        NumberOfConcurrentThreads - The maximum number of threads that the operating system can allow to concurrently process I/O completion packets for the I/O completion port.
        Returns:
        Throws:
        NullPointerException - if hFile or lpBuffer is null.
        NativeErrorException - if the return value of the native function indicates an error.
      • GetQueuedCompletionStatus

        public static void GetQueuedCompletionStatus​(Winnt.HANDLE CompletionPort,
                                                     IntRef lpNumberOfBytesTransferred,
                                                     LongRef lpCompletionKey,
                                                     ObjectRef<NativeAddressHolder> lpOverlapped,
                                                     long dwMilliseconds)
                                              throws NativeErrorException
        GetQueuedCompletionStatus Attempts to dequeue an I/O completion packet from the specified I/O completion port.
        Parameters:
        CompletionPort - A handle to the completion port.
        lpNumberOfBytesTransferred - A pointer to a variable that receives the number of bytes transferred in a completed I/O operation.
        lpCompletionKey - A pointer to a variable that receives the completion key value associated with the file handle whose I/O operation has completed.
        lpOverlapped - A pointer to a variable that receives the address of the OVERLAPPED structure that was specified when the completed I/O operation was started.
        dwMilliseconds - The number of milliseconds that the caller is willing to wait for a completion packet to appear at the completion port.
        Throws:
        NullPointerException - if hFile or lpBuffer is null.
        NativeErrorException - if the return value of the native function indicates an error.
      • PostQueuedCompletionStatus

        public static void PostQueuedCompletionStatus​(Winnt.HANDLE CompletionPort,
                                                      int dwNumberOfBytesTransferred,
                                                      long dwCompletionKey,
                                                      Minwinbase.OVERLAPPED lpOverlapped)
                                               throws NativeErrorException
        PostQueuedCompletionStatus Attempts to dequeue an I/O completion packet from the specified I/O completion port.
        Parameters:
        CompletionPort - A handle to an I/O completion port to which the I/O completion packet is to be posted.
        dwNumberOfBytesTransferred - The value to be returned through the lpNumberOfBytesTransferred parameter of the GetQueuedCompletionStatus function.
        dwCompletionKey - The value to be returned through the lpCompletionKey parameter of the GetQueuedCompletionStatus function.
        lpOverlapped - The value to be returned through the lpOverlapped parameter of the GetQueuedCompletionStatus function.
        Throws:
        NativeErrorException - if the return value of the native function indicates an error.