FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

IOService recognizes a new 3rd state of loading data by xulman · Pull Request #430 · scijava/scijava-common · GitHub

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
27 changes: 23 additions & 4 deletions src/main/java/org/scijava/io/IOService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ default <D> IOPlugin<D> getSaver(D data, Location destination) {
return null;
}

/** A special type of "openned data" that can be returned by the
* {@link #open(String)} and {@link #open(Location)} methods, and
* that signals that data is opened outside the ImageJ2 data model.
* Example is the opening of BigDataViewer's .xml files, in which case
* no image is actually loaded into ImageJ2 per se, but an instance of
* the BigDataViewer over the .xml file is opened/started instead.
*/
Object GOVERNING_APP_STARTED = new Object();

/**
* Loads data from the given source. For extensibility, the nature of the
* source is left intentionally general, but two common examples include file
Expand All @@ -95,11 +104,16 @@ default <D> IOPlugin<D> getSaver(D data, Location destination) {
* The opener to use is automatically determined based on available
* {@link IOPlugin}s; see {@link #getOpener(String)}.
* </p>
* The opener may open the source in "external" application (e.g., in BigDataViewer)
* in which case it must return {@link #GOVERNING_APP_STARTED} object (and not the
* source data itself).
* </p>
*
* @param source The source (e.g., file path) from which to data should be
* loaded.
* @return An object representing the loaded data, or null if the source is
* not supported.
* @return An object representing the loaded data, or {@link #GOVERNING_APP_STARTED}
* object signalling that the source was loaded into an external application,
* or null if the source is not supported.
* @throws IOException if something goes wrong loading the data.
*/
Object open(String source) throws IOException;
Expand All @@ -110,10 +124,15 @@ default <D> IOPlugin<D> getSaver(D data, Location destination) {
* The opener to use is automatically determined based on available
* {@link IOPlugin}s; see {@link #getOpener(Location)}.
* </p>
* The opener may open the source in "external" application (e.g., in BigDataViewer)
* in which case it must return {@link #GOVERNING_APP_STARTED} object (and not the
* source data itself).
* </p>
*
* @param source The location from which to data should be loaded.
* @return An object representing the loaded data, or null if the source is
* not supported.
* @return An object representing the loaded data, or {@link #GOVERNING_APP_STARTED}
* object signalling that the source was loaded into an external application,
* or null if the source is not supported.
* @throws IOException if something goes wrong loading the data.
*/
default Object open(Location source) throws IOException {
Expand Down

Back | FazBrowse Home | New Git URL