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.InputStreamasInputStream()Represent this Readable as an input stream.default java.io.ReaderasReader()Obtain aReaderfor this readable usingStandardCharsets.UTF_8.default java.io.ReaderasReader(java.nio.charset.Charset charset)Obtain aReaderfor this readable.booleanexists()Does the underlying readable resource exist.static Readableof(java.io.File file)Create aReadablefor the given file.static Readableof(java.net.URL url)Create aReadablefor the given URL.static Readableof(java.nio.file.Path path)Create aReadablefor 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.IOExceptionObtain aReaderfor 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.IOExceptionObtain aReaderfor 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 aReadablefor the given URL.- Parameters:
url- The URL- Returns:
- The readable.
-
of
@NonNull static Readable of(@NonNull java.io.File file)
Create aReadablefor the given file.- Parameters:
file- The file- Returns:
- The readable.
-
-