Package org.cactoos.io
Class WriterTo
- java.lang.Object
-
- java.io.Writer
-
- org.cactoos.io.WriterTo
-
- All Implemented Interfaces:
Closeable
,Flushable
,Appendable
,AutoCloseable
public final class WriterTo extends Writer
AWriter
that encapsulates other destination for the data.There is no thread-safety guarantee.
- Since:
- 0.13
-
-
Constructor Summary
Constructors Constructor Description WriterTo(File file)
Ctor.WriterTo(OutputStream stream)
Ctor.WriterTo(Path path)
Ctor.WriterTo(Output output)
Ctor.WriterTo(Output output, CharSequence charset)
Ctor.WriterTo(Output output, Charset charset)
Ctor.WriterTo(Output output, CharsetEncoder encoder)
Ctor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
void
write(char[] cbuf, int off, int len)
-
-
-
Constructor Detail
-
WriterTo
public WriterTo(Path path)
Ctor.- Parameters:
path
- The path
-
WriterTo
public WriterTo(File file)
Ctor.- Parameters:
file
- The file
-
WriterTo
public WriterTo(OutputStream stream)
Ctor.- Parameters:
stream
- The output
-
WriterTo
public WriterTo(Output output)
Ctor.- Parameters:
output
- The input
-
WriterTo
public WriterTo(Output output, Charset charset)
Ctor.- Parameters:
output
- The inputcharset
- The charset
-
WriterTo
public WriterTo(Output output, CharSequence charset)
Ctor.- Parameters:
output
- The inputcharset
- The charset
-
WriterTo
public WriterTo(Output output, CharsetEncoder encoder)
Ctor.- Parameters:
output
- The inputencoder
- Charset encoder- Since:
- 0.13.1
-
-
Method Detail
-
write
public void write(char[] cbuf, int off, int len) throws IOException
- Specified by:
write
in classWriter
- Throws:
IOException
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in classWriter
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classWriter
- Throws:
IOException
-
-