Class WriterOutputStream.Builder

    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • get

        public WriterOutputStream get()
                               throws java.io.IOException
        Constructs a new instance.

        This builder use the aspect Writer, OpenOption[], Charset, CharsetDecoder, buffer size and writeImmediately.

        You must provide an origin that can be converted to a Writer by this builder, otherwise, this call will throw an UnsupportedOperationException.

        Returns:
        a new instance.
        Throws:
        java.lang.UnsupportedOperationException - if the origin cannot provide a Writer.
        java.io.IOException - if an I/O error occurs.
        See Also:
        AbstractStreamBuilder.getWriter()
      • setCharsetDecoder

        public WriterOutputStream.Builder setCharsetDecoder​(java.nio.charset.CharsetDecoder charsetDecoder)
        Sets the charset decoder.
        Parameters:
        charsetDecoder - the charset decoder.
        Returns:
        this
      • setWriteImmediately

        public WriterOutputStream.Builder setWriteImmediately​(boolean writeImmediately)
        Sets whether the output buffer will be flushed after each write operation (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.
        Parameters:
        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.
        Returns:
        this