Interface Readable

  • All Superinterfaces:
    Named

    @Immutable
    public interface Readable
    extends Named
    Abstraction over File and URL based I/O.
    Since:
    1.1.0
    • Method Detail

      • asInputStream

        @NonNull
        java.io.InputStream asInputStream()
                                   throws java.io.IOException
        Represent this Readable as an input stream.
        Returns:
        The input stream
        Throws:
        java.io.IOException - if an I/O exception occurs
      • exists

        boolean exists()
        Does the underlying readable resource exist.
        Returns:
        True if it does
      • asReader

        default java.io.Reader asReader()
                                 throws java.io.IOException
        Obtain a Reader for this readable using StandardCharsets.UTF_8.
        Returns:
        The reader
        Throws:
        java.io.IOException - if an I/O error occurs
      • asReader

        default java.io.Reader asReader​(java.nio.charset.Charset charset)
                                 throws java.io.IOException
        Obtain a Reader for this readable.
        Parameters:
        charset - The charset to use
        Returns:
        The reader
        Throws:
        java.io.IOException - if an I/O error occurs
      • of

        @NonNull
        static Readable of​(@NonNull
                           java.nio.file.Path path)
        Create a Readable for the given path.
        Parameters:
        path - The path
        Returns:
        The readable.