@Immutable public interface Readable extends Named
Modifier and Type | Method and Description |
---|---|
InputStream |
asInputStream()
Represent this Readable as an input stream.
|
default Reader |
asReader()
Obtain a
Reader for this readable using StandardCharsets.UTF_8 . |
default Reader |
asReader(Charset charset)
Obtain a
Reader for this readable. |
boolean |
exists()
Does the underlying readable resource exist.
|
static Readable |
of(File file)
Create a
Readable for the given file. |
static Readable |
of(Path path)
Create a
Readable for the given path. |
static Readable |
of(URL url)
Create a
Readable for the given URL. |
@NonNull InputStream asInputStream() throws IOException
IOException
- if an I/O exception occursboolean exists()
default Reader asReader() throws IOException
Reader
for this readable using StandardCharsets.UTF_8
.IOException
- if an I/O error occursdefault Reader asReader(Charset charset) throws IOException
Reader
for this readable.charset
- The charset to useIOException
- if an I/O error occurs@NonNull static Readable of(@NonNull URL url)
Readable
for the given URL.url
- The URL@NonNull static Readable of(@NonNull File file)
Readable
for the given file.file
- The file