Methods Summary |
---|
public void | close()Convenience for calling getParcelFileDescriptor().close() .
mFd.close();
|
public java.io.FileInputStream | createInputStream()Create and return a new auto-close input stream for this asset. This
will either return a full asset {@link AutoCloseInputStream}, or
an underlying {@link ParcelFileDescriptor.AutoCloseInputStream
ParcelFileDescriptor.AutoCloseInputStream} depending on whether the
the object represents a complete file or sub-section of a file. You
should only call this once for a particular asset.
if (mLength < 0) {
return new ParcelFileDescriptor.AutoCloseInputStream(mFd);
}
return new AutoCloseInputStream(this);
|
public java.io.FileOutputStream | createOutputStream()Create and return a new auto-close output stream for this asset. This
will either return a full asset {@link AutoCloseOutputStream}, or
an underlying {@link ParcelFileDescriptor.AutoCloseOutputStream
ParcelFileDescriptor.AutoCloseOutputStream} depending on whether the
the object represents a complete file or sub-section of a file. You
should only call this once for a particular asset.
if (mLength < 0) {
return new ParcelFileDescriptor.AutoCloseOutputStream(mFd);
}
return new AutoCloseOutputStream(this);
|
public int | describeContents()
return mFd.describeContents();
|
public long | getDeclaredLength()Return the actual number of bytes that were declared when the
AssetFileDescriptor was constructed. Will be
{@link #UNKNOWN_LENGTH} if the length was not declared, meaning data
should be read to the end of the file.
return mLength;
|
public java.io.FileDescriptor | getFileDescriptor()Returns the FileDescriptor that can be used to read the data in the
file.
return mFd.getFileDescriptor();
|
public long | getLength()Returns the total number of bytes of this asset entry's data. May be
{@link #UNKNOWN_LENGTH} if the asset extends to the end of the file.
If the AssetFileDescriptor was constructed with {@link #UNKNOWN_LENGTH},
this will use {@link ParcelFileDescriptor#getStatSize()
ParcelFileDescriptor.getStatSize()} to find the total size of the file,
returning that number if found or {@link #UNKNOWN_LENGTH} if it could
not be determined.
if (mLength >= 0) {
return mLength;
}
long len = mFd.getStatSize();
return len >= 0 ? len : UNKNOWN_LENGTH;
|
public android.os.ParcelFileDescriptor | getParcelFileDescriptor()The AssetFileDescriptor contains its own ParcelFileDescriptor, which
in addition to the normal FileDescriptor object also allows you to close
the descriptor when you are done with it.
return mFd;
|
public long | getStartOffset()Returns the byte offset where this asset entry's data starts.
return mStartOffset;
|
public java.lang.String | toString()
return "{AssetFileDescriptor: " + mFd
+ " start=" + mStartOffset + " len=" + mLength + "}";
|
public void | writeToParcel(android.os.Parcel out, int flags)
mFd.writeToParcel(out, flags);
out.writeLong(mStartOffset);
out.writeLong(mLength);
|