org.scijava.io
Interface IOService

All Superinterfaces:
Comparable<Prioritized>, Contextual, Disposable, HandlerService<String,IOPlugin<?>>, HasPluginInfo, Prioritized, PTService<IOPlugin<?>>, RichPlugin, SciJavaPlugin, SciJavaService, Service, SingletonService<IOPlugin<?>>, Typed<String>, TypedService<String,IOPlugin<?>>
All Known Implementing Classes:
DefaultIOService

public interface IOService
extends HandlerService<String,IOPlugin<?>>, SciJavaService

Interface for data I/O operations: opening and saving data.

Author:
Curtis Rueden

Method Summary
 IOPlugin<?> getOpener(String source)
          Gets the most appropriate IOPlugin for opening data from the given source.
<D> IOPlugin<D>
getSaver(D data, String destination)
          Gets the most appropriate IOPlugin for saving data to the given destination.
 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 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
getPlugins, getPluginService, getPluginType
 
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
 
Methods inherited from interface org.scijava.Typed
getType
 

Method Detail

getOpener

IOPlugin<?> getOpener(String source)
Gets the most appropriate IOPlugin for opening data from the given source.


getSaver

<D> IOPlugin<D> getSaver(D data,
                         String destination)
Gets the most appropriate IOPlugin for saving data to the given destination.


open

Object open(String source)
            throws IOException
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 getOpener(String).

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

void save(Object data,
          String destination)
          throws IOException
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 getSaver(Object, String).

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.


Copyright © 2009–2014 SciJava. All rights reserved.