Interface Readable

All Superinterfaces:
Named

public interface Readable extends Named
Abstraction over File and URL based I/O.
Since:
1.1.0
Author:
graemerocher
  • Method Details

    • asInputStream

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

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

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

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

      static Readable of(URL url)
      Create a Readable for the given URL.
      Parameters:
      url - The URL
      Returns:
      The readable.
    • of

      static Readable of(File file)
      Create a Readable for the given file.
      Parameters:
      file - The file
      Returns:
      The readable.
    • of

      static Readable of(Path path)
      Create a Readable for the given path.
      Parameters:
      path - The path
      Returns:
      The readable.