/**@class android.os.ParcelFileDescriptor implements android.os.Parcelable implements java.io.Closeable @extends java.lang.Object The FileDescriptor returned by {@link android.os.Parcel#readFileDescriptor}, allowing you to close it when done with it. */ var ParcelFileDescriptor = { /** For use with {@link #open}: if {@link #MODE_CREATE} has been supplied and this file doesn't already exist, then create the file with permissions such that any application can read it. @deprecated Creating world-readable files is very dangerous, and likely to cause security holes in applications. It is strongly discouraged; instead, applications should use more formal mechanism for interactions such as {@link ContentProvider}, {@link BroadcastReceiver}, and {@link android.app.Service}. There are no guarantees that this access mode will remain on a file, such as when it goes through a backup and restore. */ MODE_WORLD_READABLE : "1", /** For use with {@link #open}: if {@link #MODE_CREATE} has been supplied and this file doesn't already exist, then create the file with permissions such that any application can write it. @deprecated Creating world-writable files is very dangerous, and likely to cause security holes in applications. It is strongly discouraged; instead, applications should use more formal mechanism for interactions such as {@link ContentProvider}, {@link BroadcastReceiver}, and {@link android.app.Service}. There are no guarantees that this access mode will remain on a file, such as when it goes through a backup and restore. */ MODE_WORLD_WRITEABLE : "2", /** For use with {@link #open}: open the file with read-only access. */ MODE_READ_ONLY : "268435456", /** For use with {@link #open}: open the file with write-only access. */ MODE_WRITE_ONLY : "536870912", /** For use with {@link #open}: open the file with read and write access. */ MODE_READ_WRITE : "805306368", /** For use with {@link #open}: create the file if it doesn't already exist. */ MODE_CREATE : "134217728", /** For use with {@link #open}: erase contents of file when opening. */ MODE_TRUNCATE : "67108864", /** For use with {@link #open}: append to end of file while writing. */ MODE_APPEND : "33554432", /***/ CREATOR : "null", /**Create a new ParcelFileDescriptor accessing a given file. @param {Object {File}} file The file to be opened. @param {Number} mode The desired access mode, must be one of {@link #MODE_READ_ONLY}, {@link #MODE_WRITE_ONLY}, or {@link #MODE_READ_WRITE}; may also be any combination of {@link #MODE_CREATE}, {@link #MODE_TRUNCATE}, {@link #MODE_WORLD_READABLE}, and {@link #MODE_WORLD_WRITEABLE}. @return {Object {android.os.ParcelFileDescriptor}} a new ParcelFileDescriptor pointing to the given file. @throws FileNotFoundException if the given file does not exist or can not be opened with the requested mode. @see #parseMode(String) */ open : function( ) {}, /**Create a new ParcelFileDescriptor accessing a given file. @param {Object {File}} file The file to be opened. @param {Number} mode The desired access mode, must be one of {@link #MODE_READ_ONLY}, {@link #MODE_WRITE_ONLY}, or {@link #MODE_READ_WRITE}; may also be any combination of {@link #MODE_CREATE}, {@link #MODE_TRUNCATE}, {@link #MODE_WORLD_READABLE}, and {@link #MODE_WORLD_WRITEABLE}. @param {Object {Handler}} handler to call listener from; must not be null. @param {Object {ParcelFileDescriptor.OnCloseListener}} listener to be invoked when the returned descriptor has been closed; must not be null. @return {Object {android.os.ParcelFileDescriptor}} a new ParcelFileDescriptor pointing to the given file. @throws FileNotFoundException if the given file does not exist or can not be opened with the requested mode. @see #parseMode(String) */ open : function( ) {}, /**Create a new ParcelFileDescriptor that is a dup of an existing FileDescriptor. This obeys standard POSIX semantics, where the new file descriptor shared state such as file position with the original file descriptor. */ dup : function( ) {}, /**Create a new ParcelFileDescriptor that is a dup of the existing FileDescriptor. This obeys standard POSIX semantics, where the new file descriptor shared state such as file position with the original file descriptor. */ dup : function( ) {}, /**Create a new ParcelFileDescriptor from a raw native fd. The new ParcelFileDescriptor holds a dup of the original fd passed in here, so you must still close that fd as well as the new ParcelFileDescriptor. @param {Number} fd The native fd that the ParcelFileDescriptor should dup. @return {Object {android.os.ParcelFileDescriptor}} Returns a new ParcelFileDescriptor holding a FileDescriptor for a dup of the given fd. */ fromFd : function( ) {}, /**Take ownership of a raw native fd in to a new ParcelFileDescriptor. The returned ParcelFileDescriptor now owns the given fd, and will be responsible for closing it. You must not close the fd yourself. @param {Number} fd The native fd that the ParcelFileDescriptor should adopt. @return {Object {android.os.ParcelFileDescriptor}} Returns a new ParcelFileDescriptor holding a FileDescriptor for the given fd. */ adoptFd : function( ) {}, /**Create a new ParcelFileDescriptor from the specified Socket. The new ParcelFileDescriptor holds a dup of the original FileDescriptor in the Socket, so you must still close the Socket as well as the new ParcelFileDescriptor. @param {Object {Socket}} socket The Socket whose FileDescriptor is used to create a new ParcelFileDescriptor. @return {Object {android.os.ParcelFileDescriptor}} A new ParcelFileDescriptor with the FileDescriptor of the specified Socket. */ fromSocket : function( ) {}, /**Create a new ParcelFileDescriptor from the specified DatagramSocket. @param {Object {DatagramSocket}} datagramSocket The DatagramSocket whose FileDescriptor is used to create a new ParcelFileDescriptor. @return {Object {android.os.ParcelFileDescriptor}} A new ParcelFileDescriptor with the FileDescriptor of the specified DatagramSocket. */ fromDatagramSocket : function( ) {}, /**Create two ParcelFileDescriptors structured as a data pipe. The first ParcelFileDescriptor in the returned array is the read side; the second is the write side. */ createPipe : function( ) {}, /**Create two ParcelFileDescriptors structured as a data pipe. The first ParcelFileDescriptor in the returned array is the read side; the second is the write side. <p> The write end has the ability to deliver an error message through {@link #closeWithError}(String) which can be handled by the read end calling {@link #checkError}(), usually after detecting an EOF. This can also be used to detect remote crashes. */ createReliablePipe : function( ) {}, /**Create two ParcelFileDescriptors structured as a pair of sockets connected to each other. The two sockets are indistinguishable. */ createSocketPair : function( ) {}, /** @hide */ createSocketPair : function( ) {}, /**Create two ParcelFileDescriptors structured as a pair of sockets connected to each other. The two sockets are indistinguishable. <p> Both ends have the ability to deliver an error message through {@link #closeWithError}(String) which can be detected by the other end calling {@link #checkError}(), usually after detecting an EOF. This can also be used to detect remote crashes. */ createReliableSocketPair : function( ) {}, /** @hide */ createReliableSocketPair : function( ) {}, /** @param {Object {byte[]}} data Data to copy. @param {String} name Name for the shared memory area that may back the file descriptor. This is purely informative and may be {@code null}. @param name Name for the shared memory area that may back the file descriptor. This is purely informative and may be {@code null}. @return {Object {android.os.ParcelFileDescriptor}} A ParcelFileDescriptor. @throws IOException if there is an error while creating the shared memory area. */ fromData : function( ) {}, /**Converts a string representing a file mode, such as "rw", into a bitmask suitable for use with {@link #open}. <p> @param {String} mode The string representation of the file mode. @return {Number} A bitmask representing the given file mode. @throws IllegalArgumentException if the given string does not match a known file mode. */ parseMode : function( ) {}, /**Retrieve the actual FileDescriptor associated with this object. @return {Object {java.io.FileDescriptor}} Returns the FileDescriptor associated with this object. */ getFileDescriptor : function( ) {}, /**Return the total size of the file representing this fd, as determined by {@code stat()}. Returns -1 if the fd is not a file. */ getStatSize : function( ) {}, /**This is needed for implementing AssetFileDescriptor.AutoCloseOutputStream, and I really don't think we want it to be public. @hide */ seekTo : function( ) {}, /**Return the native fd int for this ParcelFileDescriptor. The ParcelFileDescriptor still owns the fd, and it still must be closed through this API. */ getFd : function( ) {}, /**Return the native fd int for this ParcelFileDescriptor and detach it from the object here. You are now responsible for closing the fd in native code. <p> You should not detach when the original creator of the descriptor is expecting a reliable signal through {@link #close}() or {@link #closeWithError}(String). @see #canDetectErrors() */ detachFd : function( ) {}, /**Close the ParcelFileDescriptor. This implementation closes the underlying OS resources allocated to represent this stream. @throws IOException If an error occurs attempting to close this ParcelFileDescriptor. */ close : function( ) {}, /**Close the ParcelFileDescriptor, informing any peer that an error occurred while processing. If the creator of this descriptor is not observing errors, it will close normally. @param {String} msg describing the error; must not be null. */ closeWithError : function( ) {}, /**Called when the fd is being closed, for subclasses to release any other resources associated with it, such as acquired providers. @hide */ releaseResources : function( ) {}, /**Indicates if this ParcelFileDescriptor can communicate and detect remote errors/crashes. @see #checkError() */ canDetectErrors : function( ) {}, /**Detect and throw if the other end of a pipe or socket pair encountered an error or crashed. This allows a reader to distinguish between a valid EOF and an error/crash. <p> If this ParcelFileDescriptor is unable to detect remote errors, it will return silently. @throws IOException for normal errors. @throws FileDescriptorDetachedException if the remote side called {@link #detachFd()}. Once detached, the remote side is unable to communicate any errors through {@link #closeWithError(String)}. @see #canDetectErrors() */ checkError : function( ) {}, /** */ toString : function( ) {}, /** */ describeContents : function( ) {}, /**{@inheritDoc} If {@link android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE} is set in flags, the file descriptor will be closed after a copy is written to the Parcel. */ writeToParcel : function( ) {}, };