org.scijava.io
Class DefaultIOService
java.lang.Object
org.scijava.AbstractContextual
org.scijava.plugin.AbstractRichPlugin
org.scijava.service.AbstractService
org.scijava.plugin.AbstractPTService<PT>
org.scijava.plugin.AbstractSingletonService<PT>
org.scijava.plugin.AbstractHandlerService<String,IOPlugin<?>>
org.scijava.io.DefaultIOService
- All Implemented Interfaces:
- Comparable<Prioritized>, Contextual, Disposable, IOService, HandlerService<String,IOPlugin<?>>, HasPluginInfo, PTService<IOPlugin<?>>, RichPlugin, SciJavaPlugin, SingletonService<IOPlugin<?>>, TypedService<String,IOPlugin<?>>, Prioritized, SciJavaService, Service, Typed<String>
public final class DefaultIOService
- extends AbstractHandlerService<String,IOPlugin<?>>
- implements IOService
Default implementation of IOService
.
- Author:
- Curtis Rueden
DefaultIOService
public DefaultIOService()
getOpener
public IOPlugin<?> getOpener(String source)
- Description copied from interface:
IOService
- Gets the most appropriate
IOPlugin
for opening data from the given
source.
- Specified by:
getOpener
in interface IOService
getSaver
public <D> IOPlugin<D> getSaver(D data,
String destination)
- Description copied from interface:
IOService
- Gets the most appropriate
IOPlugin
for saving data to the given
destination.
- Specified by:
getSaver
in interface IOService
open
public Object open(String source)
throws IOException
- Description copied from interface:
IOService
- Loads data from the given source. For extensibility, the nature of the
source is left intentionally general, but two common examples include file
paths and URLs.
The opener to use is automatically determined based on available
IOPlugin
s; see IOService.getOpener(String)
.
- Specified by:
open
in interface IOService
- Parameters:
source
- The source (e.g., file path) from which to data should be
loaded.
- Returns:
- An object representing the loaded data, or null if the source is
not supported.
- Throws:
IOException
- if something goes wrong loading the data.
save
public void save(Object data,
String destination)
throws IOException
- Description copied from interface:
IOService
- Saves data to the given destination. The nature of the destination is left
intentionally general, but the most common example is a file path.
The saver to use is automatically determined based on available
IOPlugin
s; see IOService.getSaver(Object, String)
.
- Specified by:
save
in interface IOService
- Parameters:
data
- The data to be saved to the destination.destination
- The destination (e.g., file path) to which data should
be saved.
- Throws:
IOException
- if something goes wrong saving the data.
getPluginType
public Class<IOPlugin<?>> getPluginType()
- Description copied from interface:
PTService
- Gets the type of plugins managed by this service.
- Specified by:
getPluginType
in interface PTService<IOPlugin<?>>
getType
public Class<String> getType()
- Description copied from interface:
Typed
- Gets the type associated with the object.
- Specified by:
getType
in interface Typed<String>
Copyright © 2009–2014 SciJava. All rights reserved.