Class AbstractStreamBuilder<T,​B extends AbstractStreamBuilder<T,​B>>

    • Field Detail

      • DEFAULT_OPEN_OPTIONS

        private static final java.nio.file.OpenOption[] DEFAULT_OPEN_OPTIONS
      • charset

        private java.nio.charset.Charset charset
        The Charset, defaults to Charset.defaultCharset().
      • charsetDefault

        private java.nio.charset.Charset charsetDefault
        The Charset, defaults to Charset.defaultCharset().
      • openOptions

        private java.nio.file.OpenOption[] openOptions
    • Constructor Detail

      • AbstractStreamBuilder

        public AbstractStreamBuilder()
    • Method Detail

      • getCharSequence

        protected java.lang.CharSequence getCharSequence()
                                                  throws java.io.IOException
        Gets a CharSequence from the origin with a Charset.
        Returns:
        An input stream
        Throws:
        java.io.IOException - if an I/O error occurs.
        java.lang.UnsupportedOperationException - if the origin cannot be converted to a CharSequence.
        java.lang.IllegalStateException - if the origin is null.
        Since:
        2.13.0
        See Also:
        AbstractOrigin.getCharSequence(Charset)
      • getCharset

        public java.nio.charset.Charset getCharset()
        Gets the Charset, defaults to Charset.defaultCharset().
        Returns:
        the Charset, defaults to Charset.defaultCharset().
      • getCharsetDefault

        protected java.nio.charset.Charset getCharsetDefault()
        Gets the Charset default, defaults to Charset.defaultCharset().
        Returns:
        the Charset default, defaults to Charset.defaultCharset().
      • getInputStream

        protected java.io.InputStream getInputStream()
                                              throws java.io.IOException
        Gets an input stream from the origin with open options.
        Returns:
        An input stream
        Throws:
        java.io.IOException - if an I/O error occurs.
        java.lang.UnsupportedOperationException - if the origin cannot be converted to an InputStream.
        java.lang.IllegalStateException - if the origin is null.
        Since:
        2.13.0
        See Also:
        AbstractOrigin.getInputStream(OpenOption...)
      • getOpenOptions

        protected java.nio.file.OpenOption[] getOpenOptions()
      • getOutputStream

        protected java.io.OutputStream getOutputStream()
                                                throws java.io.IOException
        Gets an OutputStream from the origin with open options.
        Returns:
        An OutputStream
        Throws:
        java.io.IOException - if an I/O error occurs.
        java.lang.UnsupportedOperationException - if the origin cannot be converted to an OututStream.
        java.lang.IllegalStateException - if the origin is null.
        Since:
        2.13.0
        See Also:
        AbstractOrigin.getOutputStream(OpenOption...)
      • getPath

        protected java.nio.file.Path getPath()
        Gets a Path from the origin.
        Returns:
        A Path
        Throws:
        java.lang.UnsupportedOperationException - if the origin cannot be converted to a Path.
        java.lang.IllegalStateException - if the origin is null.
        Since:
        2.13.0
        See Also:
        AbstractOrigin.getPath()
      • getWriter

        protected java.io.Writer getWriter()
                                    throws java.io.IOException
        Gets an writer from the origin with open options.
        Returns:
        An writer.
        Throws:
        java.io.IOException - if an I/O error occurs.
        java.lang.UnsupportedOperationException - if the origin cannot be converted to a Writer.
        java.lang.IllegalStateException - if the origin is null.
        Since:
        2.13.0
        See Also:
        AbstractOrigin.getOutputStream(OpenOption...)
      • setBufferSize

        public B setBufferSize​(int bufferSize)
        Sets the buffer size. Invalid input (bufferSize <= 0) resets the value to its default.

        Subclasses may ignore this setting.

        Parameters:
        bufferSize - the buffer size.
        Returns:
        this.
      • setBufferSize

        public B setBufferSize​(java.lang.Integer bufferSize)
        Sets the buffer size.

        Subclasses may ignore this setting.

        Parameters:
        bufferSize - the buffer size, null resets to the default.
        Returns:
        this.
      • setBufferSizeDefault

        protected B setBufferSizeDefault​(int bufferSizeDefault)
        Sets the buffer size for subclasses to initialize.

        Subclasses may ignore this setting.

        Parameters:
        bufferSizeDefault - the buffer size, null resets to the default.
        Returns:
        this.
      • setCharset

        public B setCharset​(java.nio.charset.Charset charset)
        Sets the Charset.

        Subclasses may ignore this setting.

        Parameters:
        charset - the Charset, null resets to the default.
        Returns:
        this.
      • setCharset

        public B setCharset​(java.lang.String charset)
        Sets the Charset.

        Subclasses may ignore this setting.

        Parameters:
        charset - the Charset name, null resets to the default.
        Returns:
        this.
      • setCharsetDefault

        protected B setCharsetDefault​(java.nio.charset.Charset defaultCharset)
        Sets the Charset default for subclasses to initialize.

        Subclasses may ignore this setting.

        Parameters:
        defaultCharset - the Charset name, null resets to the default.
        Returns:
        this.