Reference:Android.os.ParcelFileDescriptor
From Triled Wiki
android.os
public class android.os.ParcelFileDescriptor
| java.lang.Object | ||
| android.os.ParcelFileDescriptor | Parcelable | |
Contents |
[edit] Nested Classes
| ParcelFileDescriptor.AutoCloseInputStream | An InputStream you can create on a ParcelFileDescriptor, which will take care of calling ParcelFileDescritor.close() for you when the stream is closed. |
| ParcelFileDescriptor.AutoCloseOutputStream | An OutputStream you can create on a ParcelFileDescriptor, which will take care of calling ParcelFileDescritor.close() for you when the stream is closed. |
[edit] Summary
[edit] Constants
| Value | ||||
|---|---|---|---|---|
| Creator | CREATOR | |||
| int | MODE_CREATE | For use with open(File, int) : create the file if it doesn't already exist. | 2 | 0x00000002 |
| int | MODE_READ | For use with open(File, int) : open the file with read access. | 0 | 0x00000000 |
| int | MODE_READ_WRITE | For use with open(File, int) : open the file with read and write access. | 1 | 0x00000001 |
| int | MODE_TRUNCATE | For use with open(File, int) : erase contents of file when opening. | 4 | 0x00000004 |
[edit] Public Methods
| void | close () | ||||
| Close the ParcelFileDescriptor. | |||||
| FileDescriptor | getFileDescriptor () | ||||
| Retrieve the actual FileDescriptor associated with this object. | |||||
| static | ParcelFileDescriptor | open (File file, int mode) | |||
| Create a new ParcelFileDescriptor accessing a given file. | |||||
| String | toString () | ||||
| Answers a string containing a concise, human-readable description of the receiver. | |||||
| void | writeToParcel (Parcel out) | ||||
[edit] Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait[edit] Methods inherited from interface android.os.Parcelable
[edit] Details
[edit] Constants
[edit] public static final Creator CREATOR
[edit] public static final int MODE_CREATE
For use with open(File, int) : create the file if it doesn't already exist. Constant Value: 2 (0x00000002)
[edit] public static final int MODE_READ
For use with open(File, int) : open the file with read access. Constant Value: 0 (0x00000000)
[edit] public static final int MODE_READ_WRITE
For use with open(File, int) : open the file with read and write access. Constant Value: 1 (0x00000001)
[edit] public static final int MODE_TRUNCATE
For use with open(File, int) : erase contents of file when opening. Constant Value: 4 (0x00000004)
[edit] Public Methods
[edit] public void close()
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. |
|---|
[edit] public FileDescriptor getFileDescriptor()
Retrieve the actual FileDescriptor associated with this object.
Returns
- Returns the FileDescriptor associated with this object.
[edit] public static ParcelFileDescriptor open(File file, int mode)
Create a new ParcelFileDescriptor accessing a given file.
Parameters
| file | The file to be opened. |
|---|---|
| mode | The desired access mode, may be MODE_READ, MODE_READ_WRITE, MODE_CREATE, MODE_TRUNCATE. |
Returns
- Returns a new ParcelFileDescriptor pointing to the given file.
Throws
| FileNotFoundException | Throws FileNotFoundException if the given file does not exist or can not be opened with the requested mode. |
|---|
[edit] public String toString()
Answers a string containing a concise, human-readable description of the receiver.
[edit] public void writeToParcel(Parcel out)
[edit] References
- Original documentation page for Android SDK build m5-rc15e - 14 apr 2008 17:27
