Interface TypedIOService<D>

    • Method Detail

      • getOpener

        default IOPlugin<D> getOpener​(String source)
        Gets the most appropriate IOPlugin for opening data from the given location.
      • getOpener

        default IOPlugin<D> getOpener​(Location source)
        Gets the most appropriate IOPlugin for opening data from the given location.
      • getSaver

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

        default IOPlugin<D> getSaver​(D data,
                                     Location destination)
        Gets the most appropriate IOPlugin for saving data to the given location.
      • open

        D 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.
      • open

        D open​(Location source)
        throws IOException
        Loads data from the given location.

        The opener to use is automatically determined based on available IOPlugins; see getOpener(Location).

        Parameters:
        source - The location 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​(D 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.
      • save

        void save​(D data,
                  Location destination)
           throws IOException
        Saves data to the given location.

        The saver to use is automatically determined based on available IOPlugins; see getSaver(Object, Location).

        Parameters:
        data - The data to be saved to the destination.
        destination - The destination location to which data should be saved.
        Throws:
        IOException - if something goes wrong saving the data.
      • canOpen

        boolean canOpen​(String source)
      • canOpen

        boolean canOpen​(Location source)
      • canSave

        boolean canSave​(D data,
                        String destination)
      • canSave

        boolean canSave​(D data,
                        Location destination)
      • getType

        default Class<Location> getType()
        Description copied from interface: Typed
        Gets the type associated with the object.
        Specified by:
        getType in interface Typed<D>