IT. Expert System.

Android Reference

AssetFileDescriptor


android.content.res

Class AssetFileDescriptor

  • All Implemented Interfaces:
    Parcelable


    public class AssetFileDescriptor
    extends Object
    implements Parcelable
    File descriptor of an entry in the AssetManager. This provides your own opened FileDescriptor that can be used to read the data, as well as the offset and length of that entry's data in the file.
    • Constructor Detail

      • AssetFileDescriptor

        public AssetFileDescriptor(ParcelFileDescriptor fd,
                           long startOffset,
                           long length)
        Create a new AssetFileDescriptor from the given values.
        Parameters:
        fd - The underlying file descriptor.
        startOffset - The location within the file that the asset starts. This must be 0 if length is UNKNOWN_LENGTH.
        length - The number of bytes of the asset, or UNKNOWN_LENGTH if it extends to the end of the file.
    • Method Detail

      • getParcelFileDescriptor

        public 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.
      • getFileDescriptor

        public FileDescriptor getFileDescriptor()
        Returns the FileDescriptor that can be used to read the data in the file.
      • getStartOffset

        public long getStartOffset()
        Returns the byte offset where this asset entry's data starts.
      • getDeclaredLength

        public long getDeclaredLength()
        Return the actual number of bytes that were declared when the AssetFileDescriptor was constructed. Will be UNKNOWN_LENGTH if the length was not declared, meaning data should be read to the end of the file.
        See Also:
        getDeclaredLength()
      • close

        public void close()
                   throws IOException
        Convenience for calling getParcelFileDescriptor().close().
        Throws:
        IOException
      • createInputStream

        public FileInputStream createInputStream()
                                          throws IOException
        Create and return a new auto-close input stream for this asset. This will either return a full asset AssetFileDescriptor.AutoCloseInputStream, or an underlying 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.
        Throws:
        IOException
      • createOutputStream

        public FileOutputStream createOutputStream()
                                            throws IOException
        Create and return a new auto-close output stream for this asset. This will either return a full asset AssetFileDescriptor.AutoCloseOutputStream, or an underlying 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.
        Throws:
        IOException
      • toString

        public String toString()
        Description copied from class: Object
        Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
           getClass().getName() + '@' + Integer.toHexString(hashCode())

        See Writing a useful toString method if you intend implementing your own toString method.

        Overrides:
        toString in class Object
        Returns:
        a printable representation of this object.
      • describeContents

        public int describeContents()
        Description copied from interface: Parcelable
        Describe the kinds of special objects contained in this Parcelable's marshalled representation.
        Specified by:
        describeContents in interface Parcelable
        Returns:
        a bitmask indicating the set of special object types marshalled by the Parcelable.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 1162 / . Delta: 0.03516 с