Package org.apache.commons.io.build
Class AbstractOrigin.WriterOrigin
- java.lang.Object
-
- org.apache.commons.io.build.AbstractSupplier<T,B>
-
- org.apache.commons.io.build.AbstractOrigin<java.io.Writer,AbstractOrigin.WriterOrigin>
-
- org.apache.commons.io.build.AbstractOrigin.WriterOrigin
-
- All Implemented Interfaces:
IOSupplier<java.io.Writer>
- Enclosing class:
- AbstractOrigin<T,B extends AbstractOrigin<T,B>>
public static class AbstractOrigin.WriterOrigin extends AbstractOrigin<java.io.Writer,AbstractOrigin.WriterOrigin>
AWriterorigin.This origin cannot provide conversions to other aspects.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.commons.io.build.AbstractOrigin
AbstractOrigin.AbstractRandomAccessFileOrigin<T extends java.io.RandomAccessFile,B extends AbstractOrigin.AbstractRandomAccessFileOrigin<T,B>>, AbstractOrigin.ByteArrayOrigin, AbstractOrigin.ChannelOrigin, AbstractOrigin.CharSequenceOrigin, AbstractOrigin.FileOrigin, AbstractOrigin.InputStreamOrigin, AbstractOrigin.IORandomAccessFileOrigin, AbstractOrigin.OutputStreamOrigin, AbstractOrigin.PathOrigin, AbstractOrigin.RandomAccessFileOrigin, AbstractOrigin.ReaderOrigin, AbstractOrigin.URIOrigin, AbstractOrigin.WriterOrigin
-
-
Constructor Summary
Constructors Constructor Description WriterOrigin(java.io.Writer origin)Constructs a new instance for the given origin.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.nio.channels.ChannelgetChannel(java.nio.file.OpenOption... options)Gets this origin as a Channel, if possible.java.io.OutputStreamgetOutputStream(java.nio.file.OpenOption... options)Gets this origin as an OutputStream, if possible.java.io.WritergetWriter(java.nio.charset.Charset charset, java.nio.file.OpenOption... options)Gets a new Writer on the origin, buffered by default.-
Methods inherited from class org.apache.commons.io.build.AbstractOrigin
get, getByteArray, getByteArray, getChannel, getCharSequence, getFile, getInputStream, getPath, getRandomAccessFile, getReader, size, toString
-
Methods inherited from class org.apache.commons.io.build.AbstractSupplier
asThis
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.commons.io.function.IOSupplier
asSupplier, getUnchecked
-
-
-
-
Constructor Detail
-
WriterOrigin
public WriterOrigin(java.io.Writer origin)
Constructs a new instance for the given origin.- Parameters:
origin- The origin, not null.- Throws:
java.lang.NullPointerException- iforiginisnull.
-
-
Method Detail
-
getChannel
protected java.nio.channels.Channel getChannel(java.nio.file.OpenOption... options) throws java.io.IOException
Description copied from class:AbstractOriginGets this origin as a Channel, if possible.- Overrides:
getChannelin classAbstractOrigin<java.io.Writer,AbstractOrigin.WriterOrigin>- Parameters:
options- Options specifying how a file-based origin is opened, ignored otherwise.- Returns:
- A new Channel on the origin.
- Throws:
java.io.IOException- If an I/O error occurs.- See Also:
AbstractOrigin.getChannel(Class, OpenOption...)
-
getOutputStream
public java.io.OutputStream getOutputStream(java.nio.file.OpenOption... options) throws java.io.IOException
Gets this origin as an OutputStream, if possible.The
optionsparameter is ignored since aWriterdoes not need anOpenOptionto be written.- Overrides:
getOutputStreamin classAbstractOrigin<java.io.Writer,AbstractOrigin.WriterOrigin>- Parameters:
options- options specifying how the file is opened- Returns:
- this origin as an OutputStream, if possible.
- Throws:
java.io.IOException- if an I/O error occurs.
-
getWriter
public java.io.Writer getWriter(java.nio.charset.Charset charset, java.nio.file.OpenOption... options) throws java.io.IOException
Gets a new Writer on the origin, buffered by default.The
charsetparameter is ignored since aWriterdoes not need aCharsetto be written.The
optionsparameter is ignored since aWriterdoes not need anOpenOptionto be written.No conversion should occur when calling this method.
- Overrides:
getWriterin classAbstractOrigin<java.io.Writer,AbstractOrigin.WriterOrigin>- Parameters:
charset- the charset to use for encodingoptions- options specifying how the file is opened- Returns:
- a new Writer on the origin.
- Throws:
java.io.IOException- if an I/O error occurs opening or creating the file.
-
-