org.scijava.io
Class DefaultIOService

java.lang.Object
  extended by org.scijava.AbstractContextual
      extended by org.scijava.plugin.AbstractRichPlugin
          extended by org.scijava.service.AbstractService
              extended by org.scijava.plugin.AbstractPTService<PT>
                  extended by org.scijava.plugin.AbstractSingletonService<PT>
                      extended by org.scijava.plugin.AbstractHandlerService<String,IOPlugin<?>>
                          extended by 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

Constructor Summary
DefaultIOService()
           
 
Method Summary
 IOPlugin<?> getOpener(String source)
          Gets the most appropriate IOPlugin for opening data from the given source.
 Class<IOPlugin<?>> getPluginType()
          Gets the type of plugins managed by this service.
<D> IOPlugin<D>
getSaver(D data, String destination)
          Gets the most appropriate IOPlugin for saving data to the given destination.
 Class<String> getType()
          Gets the type associated with the object.
 Object open(String source)
          Loads data from the given source.
 void save(Object data, String destination)
          Saves data to the given destination.
 
Methods inherited from class org.scijava.plugin.AbstractHandlerService
getHandler, supports
 
Methods inherited from class org.scijava.plugin.AbstractSingletonService
create, filterInstances, getInstance, getInstances, initialize
 
Methods inherited from class org.scijava.plugin.AbstractPTService
getPlugins, getPluginService
 
Methods inherited from class org.scijava.service.AbstractService
dispose, getContext, registerEventHandlers, setContext, toString
 
Methods inherited from class org.scijava.plugin.AbstractRichPlugin
compareTo, getInfo, getPriority, setInfo, setPriority
 
Methods inherited from class org.scijava.AbstractContextual
context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.scijava.plugin.HandlerService
getHandler, getInstances, supports
 
Methods inherited from interface org.scijava.plugin.SingletonService
getInstance
 
Methods inherited from interface org.scijava.plugin.PTService
create, getPlugins, getPluginService
 
Methods inherited from interface org.scijava.service.Service
initialize, registerEventHandlers
 
Methods inherited from interface org.scijava.Contextual
context, getContext, setContext
 
Methods inherited from interface org.scijava.Prioritized
getPriority, setPriority
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
 
Methods inherited from interface org.scijava.Disposable
dispose
 

Constructor Detail

DefaultIOService

public DefaultIOService()
Method Detail

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 IOPlugins; 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 IOPlugins; 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–2015 SciJava. All rights reserved.