Class AbstractViewIOKit<M>

All Implemented Interfaces:
PropertyBindable, PropertyConstrainable, URIAccessible, URIInputStreamable, URIOutputStreamable, ViewIOKit<M>
Direct Known Subclasses:
ModelViewIOKit

public abstract class AbstractViewIOKit<M> extends DefaultURIAccessible implements ViewIOKit<M>
Absract implementation of loading information into a view or saving information from a view.
Author:
Garret Wilson
See Also:
  • Constructor Details

    • AbstractViewIOKit

      public AbstractViewIOKit()
      Default constructor.
    • AbstractViewIOKit

      public AbstractViewIOKit(URIInputStreamable uriInputStreamable)
      URI input stream locator constructor.
      Parameters:
      uriInputStreamable - The implementation to use for accessing a URI for input, or null if the default implementation should be used.
    • AbstractViewIOKit

      public AbstractViewIOKit(URIOutputStreamable uriOutputStreamable)
      URI output stream locator constructor.
      Parameters:
      uriOutputStreamable - The implementation to use for accessing a URI for output, or null if the default implementation should be used.
    • AbstractViewIOKit

      public AbstractViewIOKit(URIInputStreamable uriInputStreamable, URIOutputStreamable uriOutputStreamable)
      Full constructor.
      Parameters:
      uriInputStreamable - The implementation to use for accessing a URI for input, or null if the default implementation should be used.
      uriOutputStreamable - The implementation to use for accessing a URI for output, or null if the default implementation should be used.
  • Method Details

    • load

      public void load(ModelView<M> view, URI uri) throws IOException
      Loads data into a view from a given URI.

      This version opens a stream and delegates to load(View, InputStream, URI).

      Specified by:
      load in interface ViewIOKit<M>
      Parameters:
      view - The view into which the data should be loaded.
      uri - The URI that identifies the resource to be loaded.
      Throws:
      IOException - Thrown if there is an error reading the data.
    • save

      public void save(ModelView<M> view, URI uri) throws IOException
      Saves a view to a given URI.

      If saving is successful and the view is Modifiable, the view's modified status is set to false.

      A calling program should first call the view's verify() method to ensure the data is valid and that the model reflects the currently entered data.

      This version opens a stream and delegates to save(View, OutputStream).

      Specified by:
      save in interface ViewIOKit<M>
      Parameters:
      view - The view the data of which will be saved at the given URI.
      uri - The URI at which the view data should be saved.
      Throws:
      IOException - Thrown if there is an error writing the data.
      See Also: