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

    • Method Detail

      • getCharSequence

        public java.lang.CharSequence getCharSequence()
                                               throws java.io.IOException
        Gets a CharSequence from the origin with a Charset.
        Returns:
        An input stream
        Throws:
        java.lang.IllegalStateException - if the origin is null.
        java.lang.UnsupportedOperationException - if the origin cannot be converted to a CharSequence.
        java.io.IOException - if an I/O error occurs.
        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

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

        public java.io.File getFile()
        Gets a File from the origin.
        Returns:
        A File
        Throws:
        java.lang.IllegalStateException - if the origin is null.
        java.lang.UnsupportedOperationException - if the origin cannot be converted to a File.
        Since:
        2.18.0
        See Also:
        AbstractOrigin.getPath()
      • getInputStream

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

        public java.nio.file.OpenOption[] getOpenOptions()
        Gets the OpenOption array.
        Returns:
        the OpenOption array.
      • getOutputStream

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

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

        public java.io.RandomAccessFile getRandomAccessFile()
                                                     throws java.io.IOException
        Gets a RandomAccessFile from the origin.
        Returns:
        A RandomAccessFile
        Throws:
        java.lang.IllegalStateException - if the origin is null.
        java.lang.UnsupportedOperationException - if the origin cannot be converted to a RandomAccessFile.
        java.io.IOException - if an I/O error occurs.
        Since:
        2.18.0
      • getReader

        public java.io.Reader getReader()
                                 throws java.io.IOException
        Gets a Reader from the origin with a Charset.
        Returns:
        A Reader
        Throws:
        java.lang.IllegalStateException - if the origin is null.
        java.lang.UnsupportedOperationException - if the origin cannot be converted to a Reader.
        java.io.IOException - if an I/O error occurs.
        Since:
        2.16.0
        See Also:
        AbstractOrigin.getReader(Charset), getCharset()
      • getWriter

        public java.io.Writer getWriter()
                                 throws java.io.IOException
        Gets a Writer from the origin with an OpenOption[].
        Returns:
        An writer.
        Throws:
        java.lang.IllegalStateException - if the origin is null.
        java.lang.UnsupportedOperationException - if the origin cannot be converted to a Writer.
        java.io.IOException - if an I/O error occurs.
        Since:
        2.13.0
        See Also:
        AbstractOrigin.getOutputStream(OpenOption...), getOpenOptions()
      • 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 instance.
      • 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 instance.
      • setBufferSizeChecker

        public B setBufferSizeChecker​(java.util.function.IntUnaryOperator bufferSizeChecker)
        Sets the buffer size checker function. Throws a IllegalArgumentException by default.
        Parameters:
        bufferSizeChecker - the buffer size checker function. null resets to the default behavior.
        Returns:
        this instance.
        Since:
        2.14.0
      • 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 instance.
      • setBufferSizeMax

        public B setBufferSizeMax​(int bufferSizeMax)
        The maximum buffer size checked by the buffer size checker. Values less or equal to 0, resets to the int max value. By default, if this value is exceeded, this methods throws an IllegalArgumentException.
        Parameters:
        bufferSizeMax - maximum buffer size checked by the buffer size checker.
        Returns:
        this instance.
        Since:
        2.14.0
      • 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 instance.
      • 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 instance.
      • 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 instance.