Class AbstractOrigin.WriterOrigin
java.lang.Object
org.apache.commons.io.build.AbstractSupplier<Writer, AbstractOrigin.WriterOrigin>
org.apache.commons.io.build.AbstractOrigin<Writer, AbstractOrigin.WriterOrigin>
org.apache.commons.io.build.AbstractOrigin.WriterOrigin
- All Implemented Interfaces:
IOSupplier<Writer>
- Enclosing class:
AbstractOrigin<T, B extends AbstractOrigin<T,B>>
public static class AbstractOrigin.WriterOrigin
extends AbstractOrigin<Writer, AbstractOrigin.WriterOrigin>
A
Writer origin.
This origin cannot provide conversions to other aspects.
- Since:
- 2.12.0
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractOrigin
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected ChannelgetChannel(OpenOption... options) Gets this origin as a Channel, if possible.getOutputStream(OpenOption... options) Gets this origin as an OutputStream, if possible.getWriter(Charset charset, OpenOption... options) Gets a new Writer on the origin, buffered by default.Methods inherited from class AbstractOrigin
get, getByteArray, getByteArray, getChannel, getCharSequence, getFile, getInputStream, getPath, getRandomAccessFile, getReader, size, toStringMethods inherited from class AbstractSupplier
asThisMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IOSupplier
asSupplier, getUnchecked
-
Constructor Details
-
WriterOrigin
Constructs a new instance for the given origin.- Parameters:
origin- The origin, not null.- Throws:
NullPointerException- iforiginisnull.
-
-
Method Details
-
getChannel
Description copied from class:AbstractOriginGets this origin as a Channel, if possible.- Overrides:
getChannelin classAbstractOrigin<Writer, AbstractOrigin.WriterOrigin>- Parameters:
options- Options specifying how a file-based origin is opened, ignored otherwise.- Returns:
- A new Channel on the origin.
- Throws:
IOException- If an I/O error occurs.- See Also:
-
getOutputStream
Gets this origin as an OutputStream, if possible.The
optionsparameter is ignored since aWriterdoes not need anOpenOptionto be written.- Overrides:
getOutputStreamin classAbstractOrigin<Writer, AbstractOrigin.WriterOrigin>- Parameters:
options- options specifying how the file is opened- Returns:
- this origin as an OutputStream, if possible.
- Throws:
IOException- if an I/O error occurs.
-
getWriter
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<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:
IOException- if an I/O error occurs opening or creating the file.
-