- java.lang.Object
-
- de.ibapl.jnhw.winapi.Fileapi
-
-
Field Summary
Fields Modifier and Type Field Description static intCREATE_ALWAYSCREATE_ALWAYS Creates a new file, always.static intCREATE_NEWCREATE_NEW Creates a new file, only if it does not already exist.static booleanHAVE_FILEAPI_Hstatic intOPEN_ALWAYSOPEN_ALWAYS Opens a file, always.static intOPEN_EXISTINGOPEN_EXISTING Opens a file or device, only if it exists.static intTRUNCATE_EXISTINGTRUNCATE_EXISTING Opens a file and truncates it so that its size is zero bytes, only if it exists.
-
Constructor Summary
Constructors Constructor Description Fileapi()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Winnt.HANDLECreateFileW(File file, int dwDesiredAccess, int dwShareMode, Minwinbase.SECURITY_ATTRIBUTES lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, Winnt.HANDLE hTemplateFile)CreateFileW Creates or opens a file or I/O device.static Winnt.HANDLECreateFileW(String lpFileName, int dwDesiredAccess, int dwShareMode, Minwinbase.SECURITY_ATTRIBUTES lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, Winnt.HANDLE hTemplateFile)CreateFileW Creates or opens a file or I/O device.static voidFlushFileBuffers(Winnt.HANDLE hFile)FlushFileBuffers Flushes the buffers of a specified file and causes all buffered data to be written to a file.static intReadFile(Winnt.HANDLE hFile, byte[] lpBuffer)ReadFile Reads data from the specified file or input/output (I/O) device.static intReadFile(Winnt.HANDLE hFile, byte[] lpBuffer, int off, int nNumberOfBytesToRead)ReadFile Reads data from the specified file or input/output (I/O) device.static intReadFile(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, int off, int nNumberOfBytesToRead)ReadFile Reads data from the specified file or input/output (I/O) device.Reads occur at the position specified by the file pointer if supported by the device.static voidReadFile(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, int off, int nNumberOfBytesToRead, Minwinbase.OVERLAPPED lpOverlapped)ReadFile Reads data from the specified file or input/output (I/O) device.static voidReadFile(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, Minwinbase.OVERLAPPED lpOverlapped)ReadFile Reads data from the specified file or input/output (I/O) device.static intReadFile(Winnt.HANDLE hFile, OpaqueMemory64 lpBuffer, long off, int nNumberOfBytesToRead)ReadFile Reads data from the specified file or input/output (I/O) device.Reads occur at the position specified by the file pointer if supported by the device.static voidReadFile(Winnt.HANDLE hFile, OpaqueMemory64 lpBuffer, long off, int nNumberOfBytesToRead, Minwinbase.OVERLAPPED lpOverlapped)ReadFile Reads data from the specified file or input/output (I/O) device.static intReadFile(Winnt.HANDLE hFile, ByteRef b)ReadFile Reads a single byte from the specified file or input/output (I/O) device.Reads occur at the position specified by the file pointer if supported by the device.static voidReadFile(Winnt.HANDLE hFile, ByteBuffer lpBuffer)ReadFile Reads data from the specified file or input/output (I/O) device.static voidReadFile(Winnt.HANDLE hFile, ByteBuffer lpBuffer, Minwinbase.OVERLAPPED lpOverlapped)ReadFile Reads data from the specified file or input/output (I/O) device.static voidReadFileEx(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, int off, int nNumberOfBytesToRead, Minwinbase.OVERLAPPED lpOverlapped, Minwinbase.LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)ReadFile Reads data from the specified file or input/output (I/O) device.static voidReadFileEx(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, Minwinbase.OVERLAPPED lpOverlapped, Minwinbase.LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)ReadFile Reads data from the specified file or input/output (I/O) device.static voidReadFileEx(Winnt.HANDLE hFile, OpaqueMemory64 lpBuffer, long off, int nNumberOfBytesToRead, Minwinbase.OVERLAPPED lpOverlapped, Minwinbase.LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)ReadFile Reads data from the specified file or input/output (I/O) device.static voidReadFileEx(Winnt.HANDLE hFile, ByteBuffer lpBuffer, Minwinbase.OVERLAPPED lpOverlapped, Minwinbase.LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)ReadFile Reads data from the specified file or input/output (I/O) device.static intWriteFile(Winnt.HANDLE hFile, byte b)WriteFile Writes data to the specified file or input/output (I/O) device.static intWriteFile(Winnt.HANDLE hFile, byte[] lpBuffer)WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device.static intWriteFile(Winnt.HANDLE hFile, byte[] lpBuffer, int off, int nNumberOfBytesToWrite)WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device.static intWriteFile(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, int off, int nNumberOfBytesToWrite)WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device.static voidWriteFile(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, int off, int nNumberOfBytesToWrite, Minwinbase.OVERLAPPED lpOverlapped)WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device.static voidWriteFile(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, Minwinbase.OVERLAPPED lpOverlapped)WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device.static intWriteFile(Winnt.HANDLE hFile, OpaqueMemory64 lpBuffer, long off, int nNumberOfBytesToWrite)WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device.static voidWriteFile(Winnt.HANDLE hFile, OpaqueMemory64 lpBuffer, long off, int nNumberOfBytesToWrite, Minwinbase.OVERLAPPED lpOverlapped)WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device.static voidWriteFile(Winnt.HANDLE hFile, ByteBuffer lpBuffer)WriteFile Writes data to the specified file or input/output (I/O) device.static voidWriteFile(Winnt.HANDLE hFile, ByteBuffer lpBuffer, Minwinbase.OVERLAPPED lpOverlapped)WriteFile Writes data to the specified file or input/output (I/O) device.static voidWriteFileEx(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, int off, int nNumberOfBytesToWrite, Minwinbase.OVERLAPPED lpOverlapped, Minwinbase.LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device.static voidWriteFileEx(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, Minwinbase.OVERLAPPED lpOverlapped, Minwinbase.LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device.This is the asynchronous write forOpaqueMemory32.static voidWriteFileEx(Winnt.HANDLE hFile, OpaqueMemory64 lpBuffer, long off, int nNumberOfBytesToWrite, Minwinbase.OVERLAPPED lpOverlapped, Minwinbase.LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device.static voidWriteFileEx(Winnt.HANDLE hFile, ByteBuffer lpBuffer, Minwinbase.OVERLAPPED lpOverlapped, Minwinbase.LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)WriteFile Writes data to the specified file or input/output (I/O) device.
-
-
-
Field Detail
-
CREATE_ALWAYS
@Define public static final int CREATE_ALWAYS
CREATE_ALWAYS Creates a new file, always.
-
CREATE_NEW
@Define public static final int CREATE_NEW
CREATE_NEW Creates a new file, only if it does not already exist.
-
HAVE_FILEAPI_H
public static final boolean HAVE_FILEAPI_H
-
OPEN_ALWAYS
@Define public static final int OPEN_ALWAYS
OPEN_ALWAYS Opens a file, always.
-
OPEN_EXISTING
@Define public static final int OPEN_EXISTING
OPEN_EXISTING Opens a file or device, only if it exists.
-
TRUNCATE_EXISTING
@Define public static final int TRUNCATE_EXISTING
TRUNCATE_EXISTING Opens a file and truncates it so that its size is zero bytes, only if it exists.
-
-
Method Detail
-
CreateFileW
public static final Winnt.HANDLE CreateFileW(String lpFileName, int dwDesiredAccess, int dwShareMode, Minwinbase.SECURITY_ATTRIBUTES lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, Winnt.HANDLE hTemplateFile) throws NativeErrorException
CreateFileW Creates or opens a file or I/O device.- Parameters:
lpFileName- The name of the file or device to be created or opened.dwDesiredAccess- The requested access to the file or device, which can be summarized as read, write, both or neither zero.dwShareMode- The requested sharing mode of the file or device, which can be read, write, both, delete, all of these, or none.lpSecurityAttributes- A pointer to aMinwinbase.SECURITY_ATTRIBUTESstructure that contains two separate but related data members: an optional security descriptor, and a Boolean value that determines whether the returned handle can be inherited by child processes.dwCreationDisposition- An action to take on a file or device that exists or does not exist.dwFlagsAndAttributes- The file or device attributes and flags, FILE_ATTRIBUTE_NORMAL being the most common default value for files.hTemplateFile- A valid handle to a template file with the GENERIC_READ access right. The template file supplies file attributes and extended attributes for the file that is being created.- Returns:
- If the function succeeds, the return value is an open handle to the specified file, device, named pipe, or mail slot.
- Throws:
NullPointerException- if lpFileName isnull.NativeErrorException- if the return value of the native function indicates an error.
-
CreateFileW
public static final Winnt.HANDLE CreateFileW(File file, int dwDesiredAccess, int dwShareMode, Minwinbase.SECURITY_ATTRIBUTES lpSecurityAttributes, int dwCreationDisposition, int dwFlagsAndAttributes, Winnt.HANDLE hTemplateFile) throws NativeErrorException
CreateFileW Creates or opens a file or I/O device.- Parameters:
file- TheFileof the file or device to be created or opened.dwDesiredAccess- The requested access to the file or device, which can be summarized as read, write, both or neither zero.dwShareMode- The requested sharing mode of the file or device, which can be read, write, both, delete, all of these, or none.lpSecurityAttributes- A pointer to aMinwinbase.SECURITY_ATTRIBUTESstructure that contains two separate but related data members: an optional security descriptor, and a Boolean value that determines whether the returned handle can be inherited by child processes.dwCreationDisposition- An action to take on a file or device that exists or does not exist.dwFlagsAndAttributes- The file or device attributes and flags, FILE_ATTRIBUTE_NORMAL being the most common default value for files.hTemplateFile- A valid handle to a template file with the GENERIC_READ access right. The template file supplies file attributes and extended attributes for the file that is being created.- Returns:
- If the function succeeds, the return value is an open handle to the specified file, device, named pipe, or mail slot.
- Throws:
NullPointerException- if file isnull.NativeErrorException- if the return value of the native function indicates an error.
-
FlushFileBuffers
public static final void FlushFileBuffers(Winnt.HANDLE hFile) throws NativeErrorException
FlushFileBuffers Flushes the buffers of a specified file and causes all buffered data to be written to a file.- Parameters:
hFile- A handle to the open file.- Throws:
NullPointerException- if hFile isnull.NativeErrorException- if the return value of the native function indicates an error.
-
ReadFile
public static int ReadFile(Winnt.HANDLE hFile, byte[] lpBuffer, int off, int nNumberOfBytesToRead) throws NativeErrorException
ReadFile Reads data from the specified file or input/output (I/O) device. Reads occur at the position specified by the file pointer if supported by the device. This is the synchronous read - for byte[] there is no asynchronous read.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- the byte array that receives the data read from a file or device.off- the start offset inlpBufferto which the data is transferred.nNumberOfBytesToRead- the maximum number of bytes to read.- Returns:
lpNumberOfBytesReadthe number of bytes read.- Throws:
NullPointerException- if hFile or lpBuffer isnull.ArrayIndexOutOfBoundsException- if off and nNumberOfBytesToRead are outside of lpBuffer.NativeErrorException- if the return value of the native function indicates an error.
-
ReadFile
public static int ReadFile(Winnt.HANDLE hFile, byte[] lpBuffer) throws NativeErrorException
ReadFile Reads data from the specified file or input/output (I/O) device. Reads occur at the position specified by the file pointer if supported by the device. This is the synchronous read - for byte[] there is no asynchronous read.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- the byte array that receives the data read from a file or device.- Returns:
lpNumberOfBytesReadthe number of bytes read.- Throws:
NullPointerException- if hFile or lpBuffer isnull.ArrayIndexOutOfBoundsException- if off and nNumberOfBytesToRead are outside of lpBuffer.NativeErrorException- if the return value of the native function indicates an error.
-
ReadFile
public static int ReadFile(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, int off, int nNumberOfBytesToRead) throws NativeErrorException
ReadFile Reads data from the specified file or input/output (I/O) device.Reads occur at the position specified by the file pointer if supported by the device. This is the synchronous read forOpaqueMemory32.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- a pointer to theOpaqueMemory32that receives the data read from a file or device.off- the start offset inbufto which the data is transferred.nNumberOfBytesToRead- the maximum number of bytes to read.- Returns:
lpNumberOfBytesReadthe number of bytes read.- Throws:
NullPointerException- if hFile or lpBuffer isnull.ArrayIndexOutOfBoundsException- if pos and nNumberOfBytesToRead are outside of lpBuffer.NativeErrorException- if the return value of the native function indicates an error.
-
ReadFile
public static int ReadFile(Winnt.HANDLE hFile, OpaqueMemory64 lpBuffer, long off, int nNumberOfBytesToRead) throws NativeErrorException
ReadFile Reads data from the specified file or input/output (I/O) device.Reads occur at the position specified by the file pointer if supported by the device. This is the synchronous read forOpaqueMemory32.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- a pointer to theOpaqueMemory32that receives the data read from a file or device.off- the start offset inbufto which the data is transferred.nNumberOfBytesToRead- the maximum number of bytes to read.- Returns:
lpNumberOfBytesReadthe number of bytes read.- Throws:
NullPointerException- if hFile or lpBuffer isnull.ArrayIndexOutOfBoundsException- if pos and nNumberOfBytesToRead are outside of lpBuffer.NativeErrorException- if the return value of the native function indicates an error.
-
ReadFile
public static int ReadFile(Winnt.HANDLE hFile, ByteRef b) throws NativeErrorException
ReadFile Reads a single byte from the specified file or input/output (I/O) device.Reads occur at the position specified by the file pointer if supported by the device. This is the synchronous read.- Parameters:
hFile- a handle to the file or I/O device.b- a pointer to theByteRefthat receives the single byte read from a file or device.- Returns:
lpNumberOfBytesReadthe number of bytes read.- Throws:
NullPointerException- if hFile or b isnull.NativeErrorException- if the return value of the native function indicates an error.
-
ReadFile
public static void ReadFile(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, int off, int nNumberOfBytesToRead, Minwinbase.OVERLAPPED lpOverlapped) throws NativeErrorException
ReadFile Reads data from the specified file or input/output (I/O) device. Reads occur at the position specified by the file pointer if supported by the device. This is the asynchronous read forOpaqueMemory32.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- a pointer to theOpaqueMemory32that receives the data read from a file or device.off- the start offset inbufto which the data is transferred.nNumberOfBytesToRead- the maximum number of bytes to read.lpOverlapped- A pointer to anMinwinbase.OVERLAPPEDstructure.- Throws:
NullPointerException- if hFile or lpBuffer or lpOverlapped isnull.ArrayIndexOutOfBoundsException- if pos and len are outside of lpBuffer.NativeErrorException- if the return value of the native function indicates an error.
-
ReadFile
public static void ReadFile(Winnt.HANDLE hFile, OpaqueMemory64 lpBuffer, long off, int nNumberOfBytesToRead, Minwinbase.OVERLAPPED lpOverlapped) throws NativeErrorException
ReadFile Reads data from the specified file or input/output (I/O) device. Reads occur at the position specified by the file pointer if supported by the device. This is the asynchronous read forOpaqueMemory32.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- a pointer to theOpaqueMemory32that receives the data read from a file or device.off- the start offset inbufto which the data is transferred.nNumberOfBytesToRead- the maximum number of bytes to read.lpOverlapped- A pointer to anMinwinbase.OVERLAPPEDstructure.- Throws:
NullPointerException- if hFile or lpBuffer or lpOverlapped isnull.ArrayIndexOutOfBoundsException- if pos and len are outside of lpBuffer.NativeErrorException- if the return value of the native function indicates an error.
-
ReadFile
public static void ReadFile(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, Minwinbase.OVERLAPPED lpOverlapped) throws NativeErrorException
ReadFile Reads data from the specified file or input/output (I/O) device. Reads occur at the position specified by the file pointer if supported by the device. This is the asynchronous read forOpaqueMemory32.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- a pointer to theOpaqueMemory32that receives all data read from a file or device.lpOverlapped- A pointer to anMinwinbase.OVERLAPPEDstructure.- Throws:
NullPointerException- if hFile or lpBuffer or lpOverlapped isnull.NativeErrorException- if the return value of the native function indicates an error.
-
ReadFile
public static final void ReadFile(Winnt.HANDLE hFile, ByteBuffer lpBuffer) throws NativeErrorException
ReadFile Reads data from the specified file or input/output (I/O) device. Reads occur at the position specified by the file pointer if supported by the device. This is the synchronous read for directByteBuffer. the position of lpBuffer is updated after successful read.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- a pointer to an directByteBufferthat receives the data read from a file or device.- Throws:
NullPointerException- if hFile or lpBuffer isnull.NativeErrorException- if the return value of the native function indicates an error.
-
ReadFile
public static final void ReadFile(Winnt.HANDLE hFile, ByteBuffer lpBuffer, Minwinbase.OVERLAPPED lpOverlapped) throws NativeErrorException
ReadFile Reads data from the specified file or input/output (I/O) device. Reads occur at the position specified by the file pointer if supported by the device. This is the asynchronous read for directByteBuffer. UseIoapiset.GetOverlappedResult(HANDLE, OVERLAPPED, ByteBuffer, boolean)to get the result and update the ByteBuffers position.ReadFile(hFile, lpBuffer, lpOverlapped); final long waitResult = WaitForSingleObject(lpOverlapped.hEvent(), INFINITE()); if (waitResult == WAIT_OBJECT_0()) { //success int bytesRead = GetOverlappedResult(hFile, readOverlapped, lpBuffer, false); } else { //error }- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- a pointer to an directByteBufferthat receives the data read from a file or device.lpOverlapped- a pointer to anMinwinbase.OVERLAPPEDstructure.- Throws:
NullPointerException- ifhFileorlpBufferorlpOverlappedisnull.NativeErrorException- if the return value of the native function indicates an error.
-
ReadFileEx
public static void ReadFileEx(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, int off, int nNumberOfBytesToRead, Minwinbase.OVERLAPPED lpOverlapped, Minwinbase.LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine) throws NativeErrorException
ReadFile Reads data from the specified file or input/output (I/O) device. Reads occur at the position specified by the file pointer if supported by the device. This is the asynchronous read forOpaqueMemory32.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- a pointer to theOpaqueMemory32that receives the data read from a file or device.off- the start offset inbufto which the data is transferred.nNumberOfBytesToRead- the maximum number of bytes to read.lpOverlapped- A pointer to anMinwinbase.OVERLAPPEDstructure.lpCompletionRoutine- A pointer to a completion routine to be called when the read operation has been completed and the calling thread is in an alertable wait state.- Throws:
NullPointerException- if hFile or lpBuffer or lpOverlapped isnull.ArrayIndexOutOfBoundsException- if pos and len are outside of lpBuffer.NativeErrorException- if the return value of the native function indicates an error.
-
ReadFileEx
public static void ReadFileEx(Winnt.HANDLE hFile, OpaqueMemory64 lpBuffer, long off, int nNumberOfBytesToRead, Minwinbase.OVERLAPPED lpOverlapped, Minwinbase.LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine) throws NativeErrorException
ReadFile Reads data from the specified file or input/output (I/O) device. Reads occur at the position specified by the file pointer if supported by the device. This is the asynchronous read forOpaqueMemory32.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- a pointer to theOpaqueMemory32that receives the data read from a file or device.off- the start offset inbufto which the data is transferred.nNumberOfBytesToRead- the maximum number of bytes to read.lpOverlapped- A pointer to anMinwinbase.OVERLAPPEDstructure.lpCompletionRoutine- A pointer to a completion routine to be called when the read operation has been completed and the calling thread is in an alertable wait state.- Throws:
NullPointerException- if hFile or lpBuffer or lpOverlapped isnull.ArrayIndexOutOfBoundsException- if pos and len are outside of lpBuffer.NativeErrorException- if the return value of the native function indicates an error.
-
ReadFileEx
public static void ReadFileEx(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, Minwinbase.OVERLAPPED lpOverlapped, Minwinbase.LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine) throws NativeErrorException
ReadFile Reads data from the specified file or input/output (I/O) device. Reads occur at the position specified by the file pointer if supported by the device. This is the asynchronous read forOpaqueMemory32.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- a pointer to theOpaqueMemory32that receives all data read from a file or device.lpOverlapped- A pointer to anMinwinbase.OVERLAPPEDstructure.lpCompletionRoutine- A pointer to a completion routine to be called when the read operation has been completed and the calling thread is in an alertable wait state.- Throws:
NullPointerException- if hFile or lpBuffer or lpOverlapped isnull.NativeErrorException- if the return value of the native function indicates an error.
-
ReadFileEx
public static final void ReadFileEx(Winnt.HANDLE hFile, ByteBuffer lpBuffer, Minwinbase.OVERLAPPED lpOverlapped, Minwinbase.LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine) throws NativeErrorException
ReadFile Reads data from the specified file or input/output (I/O) device. Reads occur at the position specified by the file pointer if supported by the device. This is the asynchronous read for directByteBuffer. UseIoapiset.GetOverlappedResult(HANDLE, OVERLAPPED, ByteBuffer, boolean)to get the result and update the ByteBuffers position.ReadFile(hFile, lpBuffer, lpOverlapped); final long waitResult = WaitForSingleObject(lpOverlapped.hEvent(), INFINITE()); if (waitResult == WAIT_OBJECT_0()) { //success int bytesRead = GetOverlappedResult(hFile, readOverlapped, lpBuffer, false); } else { //error }- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- a pointer to an directByteBufferthat receives the data read from a file or device.lpOverlapped- a pointer to anMinwinbase.OVERLAPPEDstructure.lpCompletionRoutine- A pointer to a completion routine to be called when the read operation has been completed and the calling thread is in an alertable wait state.- Throws:
NullPointerException- if hFile or lpBuffer or lpOverlapped isnull.NativeErrorException- if the return value of the native function indicates an error.
-
WriteFile
public static int WriteFile(Winnt.HANDLE hFile, byte[] lpBuffer, int off, int nNumberOfBytesToWrite) throws NativeErrorException
WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device. This is the synchronous write for a byte array.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- the byte arraylpBuffercontaining the data to be written to the file or device.off- the start offset inlpBuffer.nNumberOfBytesToWrite- the number of bytes to write.- Returns:
lpNumberOfBytesWrittenthe number of bytes written.- Throws:
NullPointerException- if hFile or lpBuffer isnull.ArrayIndexOutOfBoundsException- if pos and len are outside of lpBuffer.NativeErrorException- if the return value of the native function indicates an error.
-
WriteFile
public static int WriteFile(Winnt.HANDLE hFile, byte[] lpBuffer) throws NativeErrorException
WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device. This is the synchronous write for a byte array.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- the byte arraylpBuffercontaining the data to be written to the file or device.- Returns:
lpNumberOfBytesWrittenthe number of bytes written.- Throws:
NullPointerException- if hFile or lpBuffer isnull.ArrayIndexOutOfBoundsException- if pos and len are outside of lpBuffer.NativeErrorException- if the return value of the native function indicates an error.
-
WriteFile
public static int WriteFile(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, int off, int nNumberOfBytesToWrite) throws NativeErrorException
WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device. This is the synchronous write forOpaqueMemory32.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- theOpaqueMemory32lpBuffercontaining the data to be written to the file or device.off- the start offset inlpBuffer.nNumberOfBytesToWrite- the number of bytes to write.- Returns:
lpNumberOfBytesWrittenthe number of bytes written.- Throws:
NullPointerException- if hFile or lpBuffer isnull.ArrayIndexOutOfBoundsException- if pos and len are outside of lpBuffer.NativeErrorException- if the return value of the native function indicates an error.
-
WriteFile
public static int WriteFile(Winnt.HANDLE hFile, OpaqueMemory64 lpBuffer, long off, int nNumberOfBytesToWrite) throws NativeErrorException
WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device. This is the synchronous write forOpaqueMemory32.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- theOpaqueMemory32lpBuffercontaining the data to be written to the file or device.off- the start offset inlpBuffer.nNumberOfBytesToWrite- the number of bytes to write.- Returns:
lpNumberOfBytesWrittenthe number of bytes written.- Throws:
NullPointerException- if hFile or lpBuffer isnull.ArrayIndexOutOfBoundsException- if pos and len are outside of lpBuffer.NativeErrorException- if the return value of the native function indicates an error.
-
WriteFile
public static int WriteFile(Winnt.HANDLE hFile, byte b) throws NativeErrorException
WriteFile Writes data to the specified file or input/output (I/O) device. Writing starts at the position specified by the file pointer if supported by the device. This is the synchronous write for a single byte .- Parameters:
hFile- a handle to the file or I/O device.b- the byte to write.- Returns:
lpNumberOfBytesWrittenthe number of bytes written.- Throws:
NativeErrorException- if the return value of the native function indicates an error.
-
WriteFile
public static void WriteFile(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, int off, int nNumberOfBytesToWrite, Minwinbase.OVERLAPPED lpOverlapped) throws NativeErrorException
WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device. This is the asynchronous write forOpaqueMemory32.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- theOpaqueMemory32lpBuffercontaining the data to be written to the file or device.off- the start offset inlpBuffer.nNumberOfBytesToWrite- the number of bytes to write.lpOverlapped- a pointer to anMinwinbase.OVERLAPPEDstructure.- Throws:
NullPointerException- if hFile or lpBuffer or lpOverlapped isnull.ArrayIndexOutOfBoundsException- if pos and len are outside of lpBuffer.NativeErrorException- if the return value of the native function indicates an error.
-
WriteFile
public static void WriteFile(Winnt.HANDLE hFile, OpaqueMemory64 lpBuffer, long off, int nNumberOfBytesToWrite, Minwinbase.OVERLAPPED lpOverlapped) throws NativeErrorException
WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device. This is the asynchronous write forOpaqueMemory32.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- theOpaqueMemory32lpBuffercontaining the data to be written to the file or device.off- the start offset inlpBuffer.nNumberOfBytesToWrite- the number of bytes to write.lpOverlapped- a pointer to anMinwinbase.OVERLAPPEDstructure.- Throws:
NullPointerException- if hFile or lpBuffer or lpOverlapped isnull.ArrayIndexOutOfBoundsException- if pos and len are outside of lpBuffer.NativeErrorException- if the return value of the native function indicates an error.
-
WriteFile
public static void WriteFile(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, Minwinbase.OVERLAPPED lpOverlapped) throws NativeErrorException
WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device. This is the asynchronous write forOpaqueMemory32.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- theOpaqueMemory32lpBuffercontaining the data to be written to the file or device.lpOverlapped- a pointer to anMinwinbase.OVERLAPPEDstructure.- Throws:
NullPointerException- if hFile or lpBuffer or lpOverlapped isnull.NativeErrorException- if the return value of the native function indicates an error.
-
WriteFile
public static final void WriteFile(Winnt.HANDLE hFile, ByteBuffer lpBuffer) throws NativeErrorException
WriteFile Writes data to the specified file or input/output (I/O) device. Writing starts at the position specified by the file pointer if supported by the device. This is the synchronous write forByteBuffer.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- theByteBufferlpBuffercontaining the data to be written to the file or device.- Throws:
NullPointerException- if hFile or lpBuffer isnull.NativeErrorException- if the return value of the native function indicates an error.
-
WriteFile
public static final void WriteFile(Winnt.HANDLE hFile, ByteBuffer lpBuffer, Minwinbase.OVERLAPPED lpOverlapped) throws NativeErrorException
WriteFile Writes data to the specified file or input/output (I/O) device. Writing starts at the position specified by the file pointer if supported by the device. This is the asynchronous write forByteBuffer. UseIoapiset.GetOverlappedResult(HANDLE, OVERLAPPED, ByteBuffer, boolean)to get the result and update the ByteBuffers position.WriteFile(hFile, lpBuffer, lpOverlapped); final long waitResult = WaitForSingleObject(lpOverlapped.hEvent(), INFINITE()); if (waitResult == WAIT_OBJECT_0()) { //success int bytesWritten = GetOverlappedResult(hFile, readOverlapped, lpBuffer, false); } else { //error }- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- theByteBufferlpBuffercontaining the data to be written to the file or device.lpOverlapped- a pointer to anMinwinbase.OVERLAPPEDstructure.- Throws:
NullPointerException- if hFile or lpBuffer or lpOverlapped isnull.NativeErrorException- if the return value of the native function indicates an error.
-
WriteFileEx
public static void WriteFileEx(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, int off, int nNumberOfBytesToWrite, Minwinbase.OVERLAPPED lpOverlapped, Minwinbase.LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine) throws NativeErrorException
WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device. This is the asynchronous write forOpaqueMemory32.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- theOpaqueMemory32lpBuffercontaining the data to be written to the file or device.off- the start offset inlpBuffer.nNumberOfBytesToWrite- the number of bytes to write.lpOverlapped- a pointer to anMinwinbase.OVERLAPPEDstructure.lpCompletionRoutine- A pointer to a completion routine to be called when the write operation has been completed and the calling thread is in an alertable wait state.- Throws:
NullPointerException- if hFile or lpBuffer or lpOverlapped isnull.ArrayIndexOutOfBoundsException- if pos and len are outside of lpBuffer.NativeErrorException- if the return value of the native function indicates an error.
-
WriteFileEx
public static void WriteFileEx(Winnt.HANDLE hFile, OpaqueMemory64 lpBuffer, long off, int nNumberOfBytesToWrite, Minwinbase.OVERLAPPED lpOverlapped, Minwinbase.LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine) throws NativeErrorException
WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device. This is the asynchronous write forOpaqueMemory32.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- theOpaqueMemory32lpBuffercontaining the data to be written to the file or device.off- the start offset inlpBuffer.nNumberOfBytesToWrite- the number of bytes to write.lpOverlapped- a pointer to anMinwinbase.OVERLAPPEDstructure.lpCompletionRoutine- A pointer to a completion routine to be called when the write operation has been completed and the calling thread is in an alertable wait state.- Throws:
NullPointerException- if hFile or lpBuffer or lpOverlapped isnull.ArrayIndexOutOfBoundsException- if pos and len are outside of lpBuffer.NativeErrorException- if the return value of the native function indicates an error.
-
WriteFileEx
public static void WriteFileEx(Winnt.HANDLE hFile, OpaqueMemory32 lpBuffer, Minwinbase.OVERLAPPED lpOverlapped, Minwinbase.LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine) throws NativeErrorException
WriteFile Writes data to the specified file or input/output (I/O) device.Writing starts at the position specified by the file pointer if supported by the device.This is the asynchronous write forOpaqueMemory32.- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- theOpaqueMemory32lpBuffercontaining the data to be written to the file or device.lpOverlapped- a pointer to anMinwinbase.OVERLAPPEDstructure.lpCompletionRoutine- A pointer to a completion routine to be called when the write operation has been completed and the calling thread is in an alertable wait state.- Throws:
NullPointerException- if hFile or lpBuffer or lpOverlapped isnull.NativeErrorException- if the return value of the native function indicates an error.
-
WriteFileEx
public static final void WriteFileEx(Winnt.HANDLE hFile, ByteBuffer lpBuffer, Minwinbase.OVERLAPPED lpOverlapped, Minwinbase.LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine) throws NativeErrorException
WriteFile Writes data to the specified file or input/output (I/O) device. Writing starts at the position specified by the file pointer if supported by the device. This is the asynchronous write forByteBuffer. UseIoapiset.GetOverlappedResult(HANDLE, OVERLAPPED, ByteBuffer, boolean)to get the result and update the ByteBuffers position.WriteFile(hFile, lpBuffer, lpOverlapped); final long waitResult = WaitForSingleObject(lpOverlapped.hEvent(), INFINITE()); if (waitResult == WAIT_OBJECT_0()) { //success int bytesWritten = GetOverlappedResult(hFile, readOverlapped, lpBuffer, false); } else { //error }- Parameters:
hFile- a handle to the file or I/O device.lpBuffer- theByteBufferlpBuffercontaining the data to be written to the file or device.lpOverlapped- a pointer to anMinwinbase.OVERLAPPEDstructure.lpCompletionRoutine- A pointer to a completion routine to be called when the write operation has been completed and the calling thread is in an alertable wait state.- Throws:
NullPointerException- if hFile or lpBuffer or lpOverlapped isnull.NativeErrorException- if the return value of the native function indicates an error.
-
-