Interface Source
Locates, provides access to, and infers the format of a source image. This is an abstract interface; at least one of the sub-interfaces must be implemented.
Methods are called in the following order:
setIdentifier(Identifier)
andsetDelegate(Delegate)
(in either order)stat()
- Any other methods
shutdown()
-
Method Summary
Modifier and TypeMethodDescriptiondefault Path
getFile()
N.B.: This default implementation throws anUnsupportedOperationException
.Returns an iterator over the results of various techniques of checking the format, in the order of least to most expensive.void
setDelegate
(Delegate delegate) void
setIdentifier
(Identifier identifier) default void
shutdown()
Shuts down the instance and any of its shared resource handles, threads, etc.stat()
Checks the accessibility of the source image and returns some limited metadata.default boolean
N.B. 1: This method's return value affects the behavior ofgetFile()
.
-
Method Details
-
getIdentifier
Identifier getIdentifier()- Returns:
- Identifier of the source image to read.
-
setIdentifier
- Parameters:
identifier
- Identifier of the source image to read.
-
stat
Checks the accessibility of the source image and returns some limited metadata.
Will be called only once.
- Returns:
- Instance with as many of its properties set as possible.
- Throws:
NoSuchFileException
- if an image corresponding to the set identifier does not exist.AccessDeniedException
- if an image corresponding to the set identifier is not readable.IOException
- if there is some other issue accessing the image.
-
getFile
N.B.: This default implementation throws anUnsupportedOperationException
. It must be overridden ifsupportsFileAccess()
returnstrue
.- Returns:
- File referencing the source image corresponding to the
identifier set with
setIdentifier(is.galia.image.Identifier)
; nevernull
. - Throws:
UnsupportedOperationException
- if access to files is notsupported
.IOException
- if anything goes wrong.
-
getFormatIterator
Returns an iterator over the results of various techniques of checking the format, in the order of least to most expensive.
A typical sequence of checks would be:
- Filename extension (using
Format.inferFormat(String)
- Identifier extension (using
Format.inferFormat(Identifier)
) - Magic bytes (using
FormatDetector
)
Any of the calls to
Iterator.next()
may return either an inaccurate value, orFormat.UNKNOWN
. Clients should proceed using the first non-unknown format they encounter and, if this turns out to be wrong, iterate and try again.- Returns:
- Iterator over whatever format-inference strategies the instance supports. The instance is cached and the same one is returned every time.
- Filename extension (using
-
newInputStream
- Returns:
- Instance from which to read the source image identified by the
identifier passed to
setIdentifier(is.galia.image.Identifier)
; nevernull
. - Throws:
IOException
- if anything goes wrong.
-
setDelegate
- Parameters:
delegate
- Delegate for the current request.
-
shutdown
default void shutdown()Shuts down the instance and any of its shared resource handles, threads, etc.
Only called at the end of the application lifecycle.
The default implementation does nothing.
-
supportsFileAccess
-