Back to Fresco

FileBinaryResource

docs/javadoc/reference/com/facebook/binaryresource/FileBinaryResource.html

3.6.012.9 KB
Original Source

Fresco

|

|

Packages | Classes

Interfaces

Classes

Packages | Classes

Summary: Methods | Inherited Methods | [Expand All]

public class

FileBinaryResource

extends Object
implements BinaryResource

| java.lang.Object | | ↳ | com.facebook.binaryresource.FileBinaryResource |

Summary

Public Methods
static FileBinaryResource
static FileBinaryResource
boolean
File
int
InputStream
Opens a new InputStream for reading from this source.
byte[]
Reads the full contents of this byte source as a byte array.
long
Returns the size of this source in bytes.

| [Expand] Inherited Methods | | --- | | From class java.lang.Object

| Object | clone() | | boolean | equals(Object arg0) | | void | finalize() | | final Class<?> | getClass() | | int | hashCode() | | final void | notify() | | final void | notifyAll() | | String | toString() | | final void | wait(long arg0, int arg1) | | final void | wait(long arg0) | | final void | wait() |

| | From interface com.facebook.binaryresource.BinaryResource

| abstract InputStream | openStream() Opens a new InputStream for reading from this source. | | abstract byte[] | read() Reads the full contents of this byte source as a byte array. | | abstract long | size() Returns the size of this source in bytes. |

|

Public Methods

public static FileBinaryResource create(File file)

public static FileBinaryResource createOrNull(File file)

public boolean equals(Object obj)

public File getFile()

public int hashCode()

public InputStream openStream()

Opens a new InputStream for reading from this source. This method should return a new, independent stream each time it is called.

The caller is responsible for ensuring that the returned stream is closed.

Throws

| IOException | |

public byte[] read()

Reads the full contents of this byte source as a byte array.

Throws

| IOException | |

public long size()

Returns the size of this source in bytes. This may be a heavyweight operation that will open a stream, read (or skip, if possible) to the end of the stream and return the total number of bytes that were read.

For some sources, such as a file, this method may use a more efficient implementation. Note that in such cases, it is possible that this method will return a different number of bytes than would be returned by reading all of the bytes (for example, some special files may return a size of 0 despite actually having content when read).

In either case, if this is a mutable source such as a file, the size it returns may not be the same number of bytes a subsequent read would return.

+Generated by Doclava. +