public interface Writable extends Streamable
An interface for classes to implement that are capable of writing themselves to a Writer
Modifier and Type | Method and Description |
---|---|
default void |
writeTo(java.io.File file)
Write this
Writable to the given File . |
default void |
writeTo(java.io.OutputStream outputStream)
Write this object to the given
OutputStream using StandardCharsets.UTF_8 by default. |
default void |
writeTo(java.io.OutputStream outputStream,
java.nio.charset.Charset charset)
Write this object to the given
OutputStream using StandardCharsets.UTF_8 by default. |
void |
writeTo(java.io.Writer out)
Writes this object to the given writer.
|
void writeTo(java.io.Writer out) throws java.io.IOException
out
- the Writer to which this Writable should output its data.java.io.IOException
- if an error occurred while outputting data to the writerdefault void writeTo(java.io.OutputStream outputStream) throws java.io.IOException
OutputStream
using StandardCharsets.UTF_8
by default.writeTo
in interface Streamable
outputStream
- The output streamjava.io.IOException
- if an error occurred while outputting data to the writerdefault void writeTo(java.io.File file) throws java.io.IOException
Writable
to the given File
.writeTo
in interface Streamable
file
- The filejava.io.IOException
- if an error occurred while outputting data to the writerdefault void writeTo(java.io.OutputStream outputStream, @Nullable java.nio.charset.Charset charset) throws java.io.IOException
OutputStream
using StandardCharsets.UTF_8
by default.writeTo
in interface Streamable
outputStream
- The output streamcharset
- The charset to use. Defaults to StandardCharsets.UTF_8
java.io.IOException
- if an error occurred while outputting data to the writer