Interface StreamDataSource

  • All Superinterfaces:
    DataSource

    public interface StreamDataSource
    extends DataSource
    A data source with a single input stream. Here it is cosy for us to distance ourselves from file-system and to work with streams of data rather than files.
    • Method Detail

      • getStreamName

        @NotNull
        String getStreamName()
        Returns:
        a string identifier
      • openInputStream

        @NotNull
        InputStream openInputStream()
                             throws IOException
        Access named stream for reading. Caller is responsible to close the stream once done.
        Returns:
        stream to read from, never null
        Throws:
        IOException - if failed to open given named stream
      • openOutputStream

        @NotNull
        OutputStream openOutputStream()
                               throws IOException
        Access named stream for writing. Caller is responsible to close the stream once done.
        Returns:
        stream to write to, never null
        Throws:
        IOException - if failed to open given named stream
      • delete

        boolean delete()
        Returns:
        true if success
      • exists

        boolean exists()
        if rv == false, then openInputStream() will throw IOException so check it before reading