public static class WriterOutputStream.Builder extends AbstractStreamBuilder<WriterOutputStream,WriterOutputStream.Builder>
WriterOutputStream
instance.
For example:
WriterOutputStream s = WriterOutputStream.builder()
.setPath(path)
.setBufferSize(8192)
.setCharset(StandardCharsets.UTF_8)
.setWriteImmediately(false)
.get()
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
WriterOutputStream |
get()
Constructs a new instance.
|
WriterOutputStream.Builder |
setCharset(Charset charset)
Sets the Charset.
|
WriterOutputStream.Builder |
setCharset(String charset)
Sets the Charset.
|
WriterOutputStream.Builder |
setCharsetDecoder(CharsetDecoder charsetDecoder)
Sets the charset decoder.
|
WriterOutputStream.Builder |
setWriteImmediately(boolean writeImmediately)
Sets whether the output buffer will be flushed after each write operation (
true ), i.e. |
getBufferSize, getBufferSizeDefault, getCharset, getCharsetDefault, setBufferSize, setBufferSize, setBufferSizeDefault, setCharsetDefault
checkOrigin, getOrigin, hasOrigin, newByteArrayOrigin, newFileOrigin, newFileOrigin, newInputStreamOrigin, newOutputStreamOrigin, newPathOrigin, newPathOrigin, newReaderOrigin, newURIOrigin, newWriterOrigin, setByteArray, setFile, setFile, setInputStream, setOrigin, setOutputStream, setPath, setPath, setReader, setURI, setWriter
asThis
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asSupplier
public Builder()
public WriterOutputStream get() throws IOException
UnsupportedOperationException
- if the origin cannot be converted to a Writer.IOException
- if an I/O error occurs.public WriterOutputStream.Builder setCharset(Charset charset)
AbstractStreamBuilder
Subclasses may ignore this setting.
setCharset
in class AbstractStreamBuilder<WriterOutputStream,WriterOutputStream.Builder>
charset
- the Charset, null resets to the default.public WriterOutputStream.Builder setCharset(String charset)
AbstractStreamBuilder
Subclasses may ignore this setting.
setCharset
in class AbstractStreamBuilder<WriterOutputStream,WriterOutputStream.Builder>
charset
- the Charset name, null resets to the default.public WriterOutputStream.Builder setCharsetDecoder(CharsetDecoder charsetDecoder)
charsetDecoder
- the charset decoder.public WriterOutputStream.Builder setWriteImmediately(boolean writeImmediately)
true
), i.e. all available data will be written to the underlying
Writer
immediately. If false
, the output buffer will only be flushed when it overflows or when WriterOutputStream.flush()
or WriterOutputStream.close()
is called.writeImmediately
- If true
the output buffer will be flushed after each write operation, i.e. all available data will be written to the
underlying Writer
immediately. If false
, the output buffer will only be flushed when it overflows or when
WriterOutputStream.flush()
or WriterOutputStream.close()
is called.Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.