ParcelFileDescriptor

Class of android.os · ParcelFileDescriptor.java · Android's reference

public class ParcelFileDescriptor implements Parcelable, Closeable

An open file, as a descriptor that could go to another process.

Nested types

Fields

public static final int MODE_READ_ONLY = 0x10000000 source
public static final int MODE_WRITE_ONLY = 0x20000000 source
public static final int MODE_READ_WRITE = 0x30000000 source
public static final int MODE_CREATE = 0x08000000 source
public static final int MODE_TRUNCATE = 0x04000000 source
public static final int MODE_APPEND = 0x02000000 source
public static final Parcelable.Creator<ParcelFileDescriptor> CREATOR source

Methods

public static ParcelFileDescriptor open(File f, int mode) throws FileNotFoundException source
public static int parseMode(String mode) source
public FileDescriptor getFileDescriptor() source
public int getFd() source

the host's descriptor, which the app's native code reads as on a device

public long getStatSize() source
public RandomAccessFile file() source

the RandomAccessFile that opened the file, null for one made of a descriptor

public void close() throws IOException source
public int detachFd() source

The caller owns the descriptor from now on, and this object is closed: the descriptor given is a duplicate of this one's, which closes, so that no Java object (nor its cleaner) closes what the caller owns

public static ParcelFileDescriptor fromFd(int fd) throws IOException source

A duplicate of a descriptor of the host, which the caller keeps

public static ParcelFileDescriptor adoptFd(int fd) source

A descriptor of the host, which this object owns from now on

public static ParcelFileDescriptor dup(FileDescriptor orig) throws IOException source
public ParcelFileDescriptor dup() throws IOException source
public static ParcelFileDescriptor fromDatagramSocket(java.net.DatagramSocket datagramSocket) source

A Java socket gives no descriptor to duplicate, as a socket without one.

public int describeContents() source
public void writeToParcel(Parcel out, int flags) source

Made from ScarletNX's Sail at 166ad3910f80. The framework is ScarletNX's (GPL-3.0-or-later); the parts that follow the Android Open Source Project's sources (Apache-2.0) say so in their files.