Interface IO<T>

  • Type Parameters:
    T - The type to read and write.

    public interface IO<T>
    Support for reading or writing a particular type.
    Author:
    Garret Wilson
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      T read​(java.io.InputStream inputStream, java.net.URI baseURI)
      Reads an object from an input stream.
      void write​(java.io.OutputStream outputStream, java.net.URI baseURI, T object)
      Writes an object to an output stream.
    • Method Detail

      • read

        T read​(java.io.InputStream inputStream,
               java.net.URI baseURI)
        throws java.io.IOException
        Reads an object from an input stream.
        Parameters:
        inputStream - The input stream from which to read the data.
        baseURI - The base URI of the data, or null if no base URI is available.
        Returns:
        The object read from the input stream.
        Throws:
        java.lang.NullPointerException - if the given input stream is null.
        java.io.IOException - Thrown if there is an error reading the data.
      • write

        void write​(java.io.OutputStream outputStream,
                   java.net.URI baseURI,
                   T object)
            throws java.io.IOException
        Writes an object to an output stream.
        Parameters:
        outputStream - The output stream to which to write the data.
        baseURI - The base URI of the data, or null if no base URI is available.
        object - The object to write to the given output stream.
        Throws:
        java.lang.NullPointerException - if the given output stream and/or object is null.
        java.io.IOException - Thrown if there is an error writing the data.