English | Site Directory

Android - An Open Handset Alliance Project

android.content
public final class

android.content.AssetManager.AssetInputStream

java.lang.Object
java.io.InputStream Closeable
android.content.AssetManager.AssetInputStream

Summary

Public Methods

    final    int  available()
Answers a int representing then number of bytes that are available before this InputStream will block.
    final    void  close()
Close the InputStream.
    final    int  getAssetInt()
    final    void  mark(int readlimit)
Set a Mark position in this InputStream.
    final    boolean  markSupported()
Answers a boolean indicating whether or not this InputStream supports mark() and reset().
    final    int  read(byte[] b, int off, int len)
Reads at most length bytes from the Stream and stores them in byte array b starting at offset.
    final    int  read(byte[] b)
Reads bytes from the Stream and stores them in byte array b.
    final    int  read()
Reads a single byte from this InputStream and returns the result as an int.
    final    void  reset()
Reset this InputStream to the last marked location.
    final    long  skip(long n)
Skips n number of bytes in this InputStream.

Protected Methods

        void  finalize()
Called by the virtual machine when there are no longer any (non-weak) references to the receiver.
Methods inherited from class java.io.InputStream
Methods inherited from class java.lang.Object
Methods inherited from interface java.io.Closeable

Details

Public Methods

public final int available()

Answers a int representing then number of bytes that are available before this InputStream will block. This method always returns 0. Subclasses should override and indicate the correct number of bytes available.

Throws

IOException

public final void close()

Close the InputStream. Concrete implementations of this class should free any resources during close. This implementation does nothing.

Throws

IOException

public final int getAssetInt()

public final void mark(int readlimit)

Set a Mark position in this InputStream. The parameter readLimit indicates how many bytes can be read before a mark is invalidated. Sending reset() will reposition the Stream back to the marked position provided readLimit has not been surpassed.

This default implementation does nothing and concrete subclasses must provide their own implementations.

Parameters

readlimit the number of bytes to be able to read before invalidating the mark.

public final boolean markSupported()

Answers a boolean indicating whether or not this InputStream supports mark() and reset(). This class provides a default implementation which answers false.

public final int read(byte[] b, int off, int len)

Reads at most length bytes from the Stream and stores them in byte array b starting at offset. Answer the number of bytes actually read or -1 if no bytes were read and end of stream was encountered.

Parameters

b the byte array in which to store the read bytes.
off the offset in b to store the read bytes.
len the maximum number of bytes to store in b.

Throws

IOException

public final int read(byte[] b)

Reads bytes from the Stream and stores them in byte array b. Answer the number of bytes actually read or -1 if no bytes were read and end of stream was encountered.

Parameters

b the byte array in which to store the read bytes.

Throws

IOException

public final int read()

Reads a single byte from this InputStream and returns the result as an int. The low-order byte is returned or -1 of the end of stream was encountered. This abstract implementation must be provided by concrete subclasses.

Throws

IOException

public final void reset()

Reset this InputStream to the last marked location. If the readlimit has been passed or no mark has been set, throw IOException. This implementation throws IOException and concrete subclasses should provide proper implementations.

Throws

IOException

public final long skip(long n)

Skips n number of bytes in this InputStream. Subsequent read()'s will not return these bytes unless reset() is used. This method may perform multiple reads to read n bytes. This default implementation reads n bytes into a temporary buffer. Concrete subclasses should provide their own implementation.

Parameters

n the number of bytes to skip.

Throws

IOException

Protected Methods

protected void finalize()

Called by the virtual machine when there are no longer any (non-weak) references to the receiver. Subclasses can use this facility to guarantee that any associated resources are cleaned up before the receiver is garbage collected. Uncaught exceptions which are thrown during the running of the method cause it to terminate immediately, but are otherwise ignored.

Note: The virtual machine assumes that the implementation in class Object is empty.

Throws

Throwable
Build m5-rc15g - 14 May 2008 12:50