Package org.apache.commons.io.build
Class AbstractStreamBuilder<T,B extends AbstractStreamBuilder<T,B>>
java.lang.Object
org.apache.commons.io.build.AbstractSupplier<T,B>
org.apache.commons.io.build.AbstractOriginSupplier<T,B>
org.apache.commons.io.build.AbstractStreamBuilder<T,B>
- Type Parameters:
T- the type of instances to build.B- the type of builder subclass.
- All Implemented Interfaces:
IOSupplier<T>
- Direct Known Subclasses:
AutoCloseInputStream.Builder,BOMInputStream.Builder,BoundedInputStream.Builder,BufferedFileChannelInputStream.Builder,CharSequenceInputStream.Builder,ChecksumInputStream.Builder,ChunkedOutputStream.Builder,DeferredFileOutputStream.Builder,FileWriterWithEncoding.Builder,LockableFileWriter.Builder,MemoryMappedFileInputStream.Builder,MessageDigestCalculatingInputStream.Builder,MessageDigestInputStream.Builder,QueueInputStream.Builder,RandomAccessFileInputStream.Builder,ReadAheadInputStream.Builder,ReaderInputStream.Builder,ReversedLinesFileReader.Builder,Tailer.Builder,ThrottledInputStream.Builder,UncheckedBufferedReader.Builder,UncheckedFilterInputStream.Builder,UncheckedFilterOutputStream.Builder,UncheckedFilterReader.Builder,UncheckedFilterWriter.Builder,UnsynchronizedBufferedInputStream.Builder,UnsynchronizedByteArrayInputStream.Builder,UnsynchronizedByteArrayOutputStream.Builder,UnsynchronizedFilterInputStream.Builder,WriterOutputStream.Builder,XmlStreamReader.Builder,XmlStreamWriter.Builder
public abstract class AbstractStreamBuilder<T,B extends AbstractStreamBuilder<T,B>>
extends AbstractOriginSupplier<T,B>
Abstracts building a typed instance of
T.- Since:
- 2.12.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the Charset, defaults toCharset.defaultCharset().setBufferSize(int bufferSize) Sets the buffer size.setBufferSize(Integer bufferSize) Sets the buffer size.setBufferSizeChecker(IntUnaryOperator bufferSizeChecker) Sets the buffer size checker function.setBufferSizeMax(int bufferSizeMax) The maximum buffer size checked by the buffer size checker.setCharset(String charset) Sets the Charset.setCharset(Charset charset) Sets the Charset.setOpenOptions(OpenOption... openOptions) Sets the OpenOption[].Methods inherited from class org.apache.commons.io.build.AbstractOriginSupplier
setByteArray, setCharSequence, setFile, setFile, setInputStream, setOutputStream, setPath, setPath, setReader, setURI, setWriterMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.io.function.IOSupplier
asSupplier, get
-
Constructor Details
-
AbstractStreamBuilder
public AbstractStreamBuilder()
-
-
Method Details
-
getCharset
Gets the Charset, defaults toCharset.defaultCharset().- Returns:
- the Charset, defaults to
Charset.defaultCharset().
-
setBufferSize
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
Sets the buffer size.Subclasses may ignore this setting.
- Parameters:
bufferSize- the buffer size, null resets to the default.- Returns:
- this.
-
setBufferSizeChecker
Sets the buffer size checker function. Throws aIllegalArgumentExceptionby default.- Parameters:
bufferSizeChecker- the buffer size checker function. null resets to the default behavior.- Returns:
- this
- Since:
- 2.14.0
-
setBufferSizeMax
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 anIllegalArgumentException.- Parameters:
bufferSizeMax- maximum buffer size checked by the buffer size checker.- Returns:
- this.
- Since:
- 2.14.0
-
setCharset
Sets the Charset.Subclasses may ignore this setting.
- Parameters:
charset- the Charset, null resets to the default.- Returns:
- this.
-
setCharset
Sets the Charset.Subclasses may ignore this setting.
- Parameters:
charset- the Charset name, null resets to the default.- Returns:
- this.
-
setOpenOptions
Sets the OpenOption[].Normally used with InputStream, OutputStream, and Writer.
Subclasses may ignore this setting.
- Parameters:
openOptions- the OpenOption[] name, null resets to the default.- Returns:
- this.
- Since:
- 2.13.0
- See Also:
-