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:
- BufferedFileChannelInputStream.Builder,- CharSequenceInputStream.Builder,- ChunkedOutputStream.Builder,- DeferredFileOutputStream.Builder,- FileWriterWithEncoding.Builder,- LockableFileWriter.Builder,- MemoryMappedFileInputStream.Builder,- ProxyInputStream.AbstractBuilder,- ProxyOutputStream.Builder,- QueueInputStream.Builder,- RandomAccessFileInputStream.Builder,- RandomAccessFileOutputStream.Builder,- ReadAheadInputStream.Builder,- ReaderInputStream.Builder,- ReversedLinesFileReader.Builder,- Tailer.Builder,- UncheckedBufferedReader.Builder,- UncheckedFilterInputStream.Builder,- UncheckedFilterOutputStream.Builder,- UncheckedFilterReader.Builder,- UncheckedFilterWriter.Builder,- UnsynchronizedBufferedInputStream.Builder,- UnsynchronizedByteArrayInputStream.Builder,- UnsynchronizedByteArrayOutputStream.Builder,- UnsynchronizedFilterInputStream.Builder,- ValidatingObjectInputStream.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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionintGets the buffer size, defaults toIOUtils.DEFAULT_BUFFER_SIZE(8192).intGets the buffer size default, defaults toIOUtils.DEFAULT_BUFFER_SIZE(8192).Gets a CharSequence from the origin with a Charset.Gets the Charset, defaults toCharset.defaultCharset().Gets the Charset default, defaults toCharset.defaultCharset().getFile()Gets a File from the origin.Gets an InputStream from the origin with OpenOption[].Gets the OpenOption array.Gets an OutputStream from the origin with OpenOption[].getPath()Gets a Path from the origin.Gets a RandomAccessFile from the origin.Gets a Reader from the origin with a Charset.Gets a Writer from the origin with an OpenOption[].setBufferSize(int bufferSize) Sets the buffer size.setBufferSize(Integer bufferSize) Sets the buffer size.setBufferSizeChecker(IntUnaryOperator bufferSizeChecker) Sets the buffer size checker function.protected BsetBufferSizeDefault(int bufferSizeDefault) Sets the buffer size for subclasses to initialize.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.protected BsetCharsetDefault(Charset defaultCharset) Sets the Charset default for subclasses to initialize.setOpenOptions(OpenOption... openOptions) Sets the OpenOption[].Methods inherited from class org.apache.commons.io.build.AbstractOriginSuppliercheckOrigin, getOrigin, hasOrigin, newByteArrayOrigin, newCharSequenceOrigin, newFileOrigin, newFileOrigin, newInputStreamOrigin, newOutputStreamOrigin, newPathOrigin, newPathOrigin, newRandomAccessFileOrigin, newRandomAccessFileOrigin, newReaderOrigin, newURIOrigin, newWriterOrigin, setByteArray, setCharSequence, setFile, setFile, setInputStream, setOrigin, setOutputStream, setPath, setPath, setRandomAccessFile, setRandomAccessFile, setReader, setURI, setWriterMethods inherited from class org.apache.commons.io.build.AbstractSupplierasThisMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.io.function.IOSupplierasSupplier, get, getUnchecked
- 
Constructor Details- 
AbstractStreamBuilderpublic AbstractStreamBuilder()Constructs a new instance for subclasses.
 
- 
- 
Method Details- 
getBufferSizeGets the buffer size, defaults toIOUtils.DEFAULT_BUFFER_SIZE(8192).- Returns:
- the buffer size, defaults to IOUtils.DEFAULT_BUFFER_SIZE(8192).
 
- 
getBufferSizeDefaultGets the buffer size default, defaults toIOUtils.DEFAULT_BUFFER_SIZE(8192).- Returns:
- the buffer size default, defaults to IOUtils.DEFAULT_BUFFER_SIZE(8192).
 
- 
getCharSequenceGets a CharSequence from the origin with a Charset.- Returns:
- An input stream
- Throws:
- IllegalStateException- if the- originis- null.
- UnsupportedOperationException- if the origin cannot be converted to a CharSequence.
- IOException- if an I/O error occurs.
- Since:
- 2.13.0
- See Also:
 
- 
getCharsetGets the Charset, defaults toCharset.defaultCharset().- Returns:
- the Charset, defaults to Charset.defaultCharset().
 
- 
getCharsetDefaultGets the Charset default, defaults toCharset.defaultCharset().- Returns:
- the Charset default, defaults to Charset.defaultCharset().
 
- 
getFileGets a File from the origin.- Returns:
- A File
- Throws:
- IllegalStateException- if the- originis- null.
- UnsupportedOperationException- if the origin cannot be converted to a- File.
- Since:
- 2.18.0
- See Also:
 
- 
getInputStreamGets an InputStream from the origin with OpenOption[].- Returns:
- An input stream
- Throws:
- IllegalStateException- if the- originis- null.
- UnsupportedOperationException- if the origin cannot be converted to an- InputStream.
- IOException- if an I/O error occurs.
- Since:
- 2.13.0
- See Also:
 
- 
getOpenOptionsGets the OpenOption array.- Returns:
- the OpenOption array.
 
- 
getOutputStreamGets an OutputStream from the origin with OpenOption[].- Returns:
- An OutputStream
- Throws:
- IllegalStateException- if the- originis- null.
- UnsupportedOperationException- if the origin cannot be converted to an- OutputStream.
- IOException- if an I/O error occurs.
- Since:
- 2.13.0
- See Also:
 
- 
getPathGets a Path from the origin.- Returns:
- A Path
- Throws:
- IllegalStateException- if the- originis- null.
- UnsupportedOperationException- if the origin cannot be converted to a- Path.
- Since:
- 2.13.0
- See Also:
 
- 
getRandomAccessFileGets a RandomAccessFile from the origin.- Returns:
- A RandomAccessFile
- Throws:
- IllegalStateException- if the- originis- null.
- UnsupportedOperationException- if the origin cannot be converted to a- RandomAccessFile.
- IOException- if an I/O error occurs.
- Since:
- 2.18.0
 
- 
getReaderGets a Reader from the origin with a Charset.- Returns:
- A Reader
- Throws:
- IllegalStateException- if the- originis- null.
- UnsupportedOperationException- if the origin cannot be converted to a- Reader.
- IOException- if an I/O error occurs.
- Since:
- 2.16.0
- See Also:
 
- 
getWriterGets a Writer from the origin with an OpenOption[].- Returns:
- An writer.
- Throws:
- IllegalStateException- if the- originis- null.
- UnsupportedOperationException- if the origin cannot be converted to a- Writer.
- IOException- if an I/O error occurs.
- Since:
- 2.13.0
- See Also:
 
- 
setBufferSizeSets the buffer size. Invalid input (bufferSize <= 0) resets the value to its default.Subclasses may ignore this setting. - Parameters:
- bufferSize- the buffer size.
- Returns:
- thisinstance.
 
- 
setBufferSizeSets the buffer size.Subclasses may ignore this setting. - Parameters:
- bufferSize- the buffer size, null resets to the default.
- Returns:
- thisinstance.
 
- 
setBufferSizeCheckerSets the buffer size checker function. Throws aIllegalArgumentExceptionby default.- Parameters:
- bufferSizeChecker- the buffer size checker function. null resets to the default behavior.
- Returns:
- thisinstance.
- Since:
- 2.14.0
 
- 
setBufferSizeDefaultSets the buffer size for subclasses to initialize.Subclasses may ignore this setting. - Parameters:
- bufferSizeDefault- the buffer size, null resets to the default.
- Returns:
- thisinstance.
 
- 
setBufferSizeMaxThe 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:
- thisinstance.
- Since:
- 2.14.0
 
- 
setCharsetSets the Charset.Subclasses may ignore this setting. - Parameters:
- charset- the Charset, null resets to the default.
- Returns:
- thisinstance.
 
- 
setCharsetSets the Charset.Subclasses may ignore this setting. - Parameters:
- charset- the Charset name, null resets to the default.
- Returns:
- thisinstance.
 
- 
setCharsetDefaultSets the Charset default for subclasses to initialize.Subclasses may ignore this setting. - Parameters:
- defaultCharset- the Charset name, null resets to the default.
- Returns:
- thisinstance.
 
- 
setOpenOptionsSets 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:
- thisinstance.
- Since:
- 2.13.0
- See Also:
 
 
-