Stay organized with collections
Save and categorize content based on your preferences.
File Descriptor
Summary
Functions
|
AFileDescriptor_create(JNIEnv *env)
|
jobject
Returns a new java.io.FileDescriptor.
|
AFileDescriptor_getFd(JNIEnv *env, jobject fileDescriptor)
|
int
Returns the Unix file descriptor represented by the given java.io.FileDescriptor.
|
AFileDescriptor_setFd(JNIEnv *env, jobject fileDescriptor, int fd)
|
void
Sets the Unix file descriptor represented by the given java.io.FileDescriptor.
|
Functions
AFileDescriptor_create
Declared in android/file_descriptor_jni.h
jobject AFileDescriptor_create(
JNIEnv *env
)
Returns a new java.io.FileDescriptor.
The FileDescriptor created represents an invalid Unix file descriptor (represented by a file descriptor value of -1).
Callers of this method should be aware that it can fail, returning NULL with a pending Java exception.
Available since API level 31.
Details |
Parameters |
env
|
a pointer to the JNI Native Interface of the current thread.
|
|
Returns
|
a java.io.FileDescriptor on success, nullptr if insufficient heap memory is available.
|
AFileDescriptor_getFd
Declared in android/file_descriptor_jni.h
int AFileDescriptor_getFd(
JNIEnv *env,
jobject fileDescriptor
)
Returns the Unix file descriptor represented by the given java.io.FileDescriptor.
A return value of -1 indicates that fileDescriptor represents an invalid file descriptor.
Aborts the program if fileDescriptor is not a java.io.FileDescriptor instance.
Available since API level 31.
Details |
Parameters |
env
|
a pointer to the JNI Native Interface of the current thread.
|
fileDescriptor
|
a java.io.FileDescriptor instance.
|
|
Returns
|
the Unix file descriptor wrapped by fileDescriptor.
|
AFileDescriptor_setFd
Declared in android/file_descriptor_jni.h
void AFileDescriptor_setFd(
JNIEnv *env,
jobject fileDescriptor,
int fd
)
Sets the Unix file descriptor represented by the given java.io.FileDescriptor.
This function performs no validation of the Unix file descriptor argument, fd. Android uses the value -1 to represent an invalid file descriptor, all other values are considered valid. The validity of a file descriptor can be checked with FileDescriptor::valid().
Aborts the program if fileDescriptor is not a java.io.FileDescriptor instance.
Available since API level 31.
Details |
Parameters |
env
|
a pointer to the JNI Native Interface of the current thread.
|
fileDescriptor
|
a java.io.FileDescriptor instance.
|
fd
|
a Unix file descriptor that fileDescriptor will subsequently represent.
|
|
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-11-19 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-19 UTC."],[],[],null,["# File Descriptor\n===============\n\nSummary\n-------\n\n| ### Functions ||\n|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|\n| [AFileDescriptor_create](#group___file_descriptor_1ga65782b07ca8d7ad4490db720d85962a3)`(JNIEnv *env)` | `jobject` Returns a new java.io.FileDescriptor. |\n| [AFileDescriptor_getFd](#group___file_descriptor_1ga3ecba59fffc0981b338eb6cc63be1168)`(JNIEnv *env, jobject fileDescriptor)` | `int` Returns the Unix file descriptor represented by the given java.io.FileDescriptor. |\n| [AFileDescriptor_setFd](#group___file_descriptor_1ga12ab09f7ae8eba8e9634ae2032bccb1f)`(JNIEnv *env, jobject fileDescriptor, int fd)` | `void` Sets the Unix file descriptor represented by the given java.io.FileDescriptor. |\n\nFunctions\n---------\n\n### AFileDescriptor_create\n\nDeclared in `android/file_descriptor_jni.h` \n\n```scdoc\njobject AFileDescriptor_create(\n JNIEnv *env\n)\n``` \nReturns a new java.io.FileDescriptor.\n\nThe FileDescriptor created represents an invalid Unix file descriptor (represented by a file descriptor value of -1).\n\nCallers of this method should be aware that it can fail, returning NULL with a pending Java exception.\n\nAvailable since API level 31.\n\n\u003cbr /\u003e\n\n| Details ||\n|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |-------|--------------------------------------------------------------| | `env` | a pointer to the JNI Native Interface of the current thread. | |\n| **Returns** | a java.io.FileDescriptor on success, nullptr if insufficient heap memory is available. |\n\n### AFileDescriptor_getFd\n\nDeclared in `android/file_descriptor_jni.h` \n\n```scdoc\nint AFileDescriptor_getFd(\n JNIEnv *env,\n jobject fileDescriptor\n)\n``` \nReturns the Unix file descriptor represented by the given java.io.FileDescriptor.\n\nA return value of -1 indicates that *fileDescriptor* represents an invalid file descriptor.\n\nAborts the program if *fileDescriptor* is not a java.io.FileDescriptor instance.\n\nAvailable since API level 31.\n\n\u003cbr /\u003e\n\n| Details ||\n|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |------------------|--------------------------------------------------------------| | `env` | a pointer to the JNI Native Interface of the current thread. | | `fileDescriptor` | a java.io.FileDescriptor instance. | |\n| **Returns** | the Unix file descriptor wrapped by *fileDescriptor*. |\n\n### AFileDescriptor_setFd\n\nDeclared in `android/file_descriptor_jni.h` \n\n```scdoc\nvoid AFileDescriptor_setFd(\n JNIEnv *env,\n jobject fileDescriptor,\n int fd\n)\n``` \nSets the Unix file descriptor represented by the given java.io.FileDescriptor.\n\nThis function performs no validation of the Unix file descriptor argument, *fd*. Android uses the value -1 to represent an invalid file descriptor, all other values are considered valid. The validity of a file descriptor can be checked with FileDescriptor::valid().\n\nAborts the program if *fileDescriptor* is not a java.io.FileDescriptor instance.\n\nAvailable since API level 31.\n\n\u003cbr /\u003e\n\n| Details ||\n|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |------------------|---------------------------------------------------------------------------| | `env` | a pointer to the JNI Native Interface of the current thread. | | `fileDescriptor` | a java.io.FileDescriptor instance. | | `fd` | a Unix file descriptor that *fileDescriptor* will subsequently represent. | |"]]