Package io.micronaut.core.io
Interface Readable
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.io.InputStream
asInputStream()
Represent this Readable as an input stream.default java.io.Reader
asReader()
Obtain aReader
for this readable usingStandardCharsets.UTF_8
.default java.io.Reader
asReader(java.nio.charset.Charset charset)
Obtain aReader
for this readable.boolean
exists()
Does the underlying readable resource exist.static Readable
of(java.io.File file)
Create aReadable
for the given file.static Readable
of(java.net.URL url)
Create aReadable
for the given URL.static Readable
of(java.nio.file.Path path)
Create aReadable
for the given path.
-
-
-
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 aReader
for this readable usingStandardCharsets.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 aReader
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.net.URL url)
Create aReadable
for the given URL.- Parameters:
url
- The URL- Returns:
- The readable.
-
of
@NonNull static Readable of(@NonNull java.io.File file)
Create aReadable
for the given file.- Parameters:
file
- The file- Returns:
- The readable.
-
-