-
- All Implemented Interfaces:
-
java.io.Closeable,java.lang.AutoCloseable
public class ImageSource implements Closeable
Provides access to the image data to be decoded.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public abstract classImageSource.MetadataA marker class for metadata for an ImageSource.
Heavily prefer using source or file to decode the image's data instead of relying on information provided in the metadata. It's the responsibility of a Fetcher to create a BufferedSource or File that can be easily read irrespective of where the image data is located. A Decoder should be as decoupled as possible from where the image is being fetched from.
This method is provided as a way to pass information to decoders that don't support decoding a BufferedSource and want to avoid creating a temporary file (e.g. ImageDecoder, MediaMetadataRetriever, etc.).
-
Field Summary
Fields Modifier and Type Field Description private final FileSystemfileSystemprivate final ImageSource.Metadatametadata
-
Method Summary
Modifier and Type Method Description abstract FileSystemgetFileSystem()The FileSystem which contains the file. abstract ImageSource.MetadatagetMetadata()Return the Metadata for this ImageSource. abstract BufferedSourcesource()Return a BufferedSource to read this ImageSource. abstract BufferedSourcesourceOrNull()Return the BufferedSource to read this ImageSource if one has already been created. abstract Pathfile()Return a Path that resolves to a file containing this ImageSource's data. abstract PathfileOrNull()Return a Path that resolves to a file containing this ImageSource's data if one has already been created. -
-
Method Detail
-
getFileSystem
abstract FileSystem getFileSystem()
The FileSystem which contains the file.
-
getMetadata
abstract ImageSource.Metadata getMetadata()
Return the Metadata for this ImageSource.
-
source
abstract BufferedSource source()
Return a BufferedSource to read this ImageSource.
-
sourceOrNull
abstract BufferedSource sourceOrNull()
Return the BufferedSource to read this ImageSource if one has already been created. Else, return 'null'.
-
file
abstract Path file()
Return a Path that resolves to a file containing this ImageSource's data.
If this image source is backed by a BufferedSource, a temporary file containing this ImageSource's data will be created.
-
fileOrNull
abstract Path fileOrNull()
Return a Path that resolves to a file containing this ImageSource's data if one has already been created. Else, return 'null'.
-
-
-
-