T - the type of instances to build.B - the type of builder subclass.public abstract class AbstractStreamBuilder<T,B extends AbstractStreamBuilder<T,B>> extends AbstractOriginSupplier<T,B>
T.| Constructor and Description |
|---|
AbstractStreamBuilder()
Constructs a new instance for subclasses.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getBufferSize()
Gets the buffer size, defaults to
IOUtils.DEFAULT_BUFFER_SIZE. |
int |
getBufferSizeDefault()
Gets the buffer size default, defaults to
IOUtils.DEFAULT_BUFFER_SIZE. |
CharSequence |
getCharSequence()
Gets a CharSequence from the origin with a Charset.
|
Charset |
getCharset()
Gets the Charset, defaults to
Charset.defaultCharset(). |
Charset |
getCharsetDefault()
Gets the Charset default, defaults to
Charset.defaultCharset(). |
File |
getFile()
Gets a File from the origin.
|
InputStream |
getInputStream()
Gets an InputStream from the origin with OpenOption[].
|
OpenOption[] |
getOpenOptions()
Gets the OpenOption array.
|
OutputStream |
getOutputStream()
Gets an OutputStream from the origin with OpenOption[].
|
Path |
getPath()
Gets a Path from the origin.
|
RandomAccessFile |
getRandomAccessFile()
Gets a RandomAccessFile from the origin.
|
Reader |
getReader()
Gets a Reader from the origin with a Charset.
|
Writer |
getWriter()
Gets a Writer from the origin with an OpenOption[].
|
B |
setBufferSize(int bufferSize)
Sets the buffer size.
|
B |
setBufferSize(Integer bufferSize)
Sets the buffer size.
|
B |
setBufferSizeChecker(java.util.function.IntUnaryOperator bufferSizeChecker)
Sets the buffer size checker function.
|
protected B |
setBufferSizeDefault(int bufferSizeDefault)
Sets the buffer size for subclasses to initialize.
|
B |
setBufferSizeMax(int bufferSizeMax)
The maximum buffer size checked by the buffer size checker.
|
B |
setCharset(Charset charset)
Sets the Charset.
|
B |
setCharset(String charset)
Sets the Charset.
|
protected B |
setCharsetDefault(Charset defaultCharset)
Sets the Charset default for subclasses to initialize.
|
B |
setOpenOptions(OpenOption... openOptions)
Sets the OpenOption[].
|
checkOrigin, 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, setWriterasThisclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasSupplier, get, getUncheckedpublic AbstractStreamBuilder()
public int getBufferSize()
IOUtils.DEFAULT_BUFFER_SIZE.IOUtils.DEFAULT_BUFFER_SIZE.public int getBufferSizeDefault()
IOUtils.DEFAULT_BUFFER_SIZE.IOUtils.DEFAULT_BUFFER_SIZE.public CharSequence getCharSequence() throws IOException
IllegalStateException - if the origin is null.UnsupportedOperationException - if the origin cannot be converted to a CharSequence.IOException - if an I/O error occurs.AbstractOrigin.getCharSequence(Charset)public Charset getCharset()
Charset.defaultCharset().Charset.defaultCharset().public Charset getCharsetDefault()
Charset.defaultCharset().Charset.defaultCharset().public File getFile()
IllegalStateException - if the origin is null.UnsupportedOperationException - if the origin cannot be converted to a File.AbstractOrigin.getPath()public InputStream getInputStream() throws IOException
IllegalStateException - if the origin is null.UnsupportedOperationException - if the origin cannot be converted to an InputStream.IOException - if an I/O error occurs.AbstractOrigin.getInputStream(OpenOption...),
getOpenOptions()public OpenOption[] getOpenOptions()
public OutputStream getOutputStream() throws IOException
IllegalStateException - if the origin is null.UnsupportedOperationException - if the origin cannot be converted to an OutputStream.IOException - if an I/O error occurs.AbstractOrigin.getOutputStream(OpenOption...),
getOpenOptions()public Path getPath()
IllegalStateException - if the origin is null.UnsupportedOperationException - if the origin cannot be converted to a Path.AbstractOrigin.getPath()public RandomAccessFile getRandomAccessFile() throws IOException
IllegalStateException - if the origin is null.UnsupportedOperationException - if the origin cannot be converted to a RandomAccessFile.IOException - if an I/O error occurs.public Reader getReader() throws IOException
IllegalStateException - if the origin is null.UnsupportedOperationException - if the origin cannot be converted to a Reader.IOException - if an I/O error occurs.AbstractOrigin.getReader(Charset),
getCharset()public Writer getWriter() throws IOException
IllegalStateException - if the origin is null.UnsupportedOperationException - if the origin cannot be converted to a Writer.IOException - if an I/O error occurs.AbstractOrigin.getOutputStream(OpenOption...),
getOpenOptions()public B setBufferSize(int bufferSize)
Subclasses may ignore this setting.
bufferSize - the buffer size.this instance.public B setBufferSize(Integer bufferSize)
Subclasses may ignore this setting.
bufferSize - the buffer size, null resets to the default.this instance.public B setBufferSizeChecker(java.util.function.IntUnaryOperator bufferSizeChecker)
IllegalArgumentException by default.bufferSizeChecker - the buffer size checker function. null resets to the default behavior.this instance.protected B setBufferSizeDefault(int bufferSizeDefault)
Subclasses may ignore this setting.
bufferSizeDefault - the buffer size, null resets to the default.this instance.public B setBufferSizeMax(int bufferSizeMax)
IllegalArgumentException.bufferSizeMax - maximum buffer size checked by the buffer size checker.this instance.public B setCharset(Charset charset)
Subclasses may ignore this setting.
charset - the Charset, null resets to the default.this instance.public B setCharset(String charset)
Subclasses may ignore this setting.
charset - the Charset name, null resets to the default.this instance.protected B setCharsetDefault(Charset defaultCharset)
Subclasses may ignore this setting.
defaultCharset - the Charset name, null resets to the default.this instance.public B setOpenOptions(OpenOption... openOptions)
Normally used with InputStream, OutputStream, and Writer.
Subclasses may ignore this setting.
openOptions - the OpenOption[] name, null resets to the default.this instance.AbstractOriginSupplier.setInputStream(InputStream),
AbstractOriginSupplier.setOutputStream(OutputStream),
AbstractOriginSupplier.setWriter(Writer)