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() |
Modifier and Type | Method and Description |
---|---|
protected int |
getBufferSize()
Gets the buffer size, defaults to
IOUtils.DEFAULT_BUFFER_SIZE (). |
protected int |
getBufferSizeDefault()
Gets the buffer size default, defaults to
IOUtils.DEFAULT_BUFFER_SIZE (). |
protected CharSequence |
getCharSequence()
Gets a CharSequence from the origin with a Charset.
|
Charset |
getCharset()
Gets the Charset, defaults to
Charset.defaultCharset() . |
protected Charset |
getCharsetDefault()
Gets the Charset default, defaults to
Charset.defaultCharset() . |
protected InputStream |
getInputStream()
Gets an input stream from the origin with open options.
|
protected OpenOption[] |
getOpenOptions() |
protected OutputStream |
getOutputStream()
Gets an OutputStream from the origin with open options.
|
protected Path |
getPath()
Gets a Path from the origin.
|
protected Writer |
getWriter()
Gets an writer from the origin with open options.
|
B |
setBufferSize(int bufferSize)
Sets the buffer size.
|
B |
setBufferSize(Integer bufferSize)
Sets the buffer size.
|
protected B |
setBufferSizeDefault(int bufferSizeDefault)
Sets the buffer size for subclasses to initialize.
|
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, newReaderOrigin, newURIOrigin, newWriterOrigin, setByteArray, setCharSequence, setFile, setFile, setInputStream, setOrigin, setOutputStream, setPath, setPath, setReader, setURI, setWriter
asThis
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asSupplier, get
public AbstractStreamBuilder()
protected int getBufferSize()
IOUtils.DEFAULT_BUFFER_SIZE
().IOUtils.DEFAULT_BUFFER_SIZE
().protected int getBufferSizeDefault()
IOUtils.DEFAULT_BUFFER_SIZE
().IOUtils.DEFAULT_BUFFER_SIZE
().protected CharSequence getCharSequence() throws IOException
IOException
- if an I/O error occurs.UnsupportedOperationException
- if the origin cannot be converted to a CharSequence.IllegalStateException
- if the origin
is null
.AbstractOrigin.getCharSequence(Charset)
public Charset getCharset()
Charset.defaultCharset()
.Charset.defaultCharset()
.protected Charset getCharsetDefault()
Charset.defaultCharset()
.Charset.defaultCharset()
.protected InputStream getInputStream() throws IOException
IOException
- if an I/O error occurs.UnsupportedOperationException
- if the origin cannot be converted to an InputStream.IllegalStateException
- if the origin
is null
.AbstractOrigin.getInputStream(OpenOption...)
protected OpenOption[] getOpenOptions()
protected OutputStream getOutputStream() throws IOException
IOException
- if an I/O error occurs.UnsupportedOperationException
- if the origin cannot be converted to an OututStream.IllegalStateException
- if the origin
is null
.AbstractOrigin.getOutputStream(OpenOption...)
protected Path getPath()
UnsupportedOperationException
- if the origin cannot be converted to a Path.IllegalStateException
- if the origin
is null
.AbstractOrigin.getPath()
protected Writer getWriter() throws IOException
IOException
- if an I/O error occurs.UnsupportedOperationException
- if the origin cannot be converted to a Writer.IllegalStateException
- if the origin
is null
.AbstractOrigin.getOutputStream(OpenOption...)
public B setBufferSize(int bufferSize)
Subclasses may ignore this setting.
bufferSize
- the buffer size.public B setBufferSize(Integer bufferSize)
Subclasses may ignore this setting.
bufferSize
- the buffer size, null resets to the default.protected B setBufferSizeDefault(int bufferSizeDefault)
Subclasses may ignore this setting.
bufferSizeDefault
- the buffer size, null resets to the default.public B setCharset(Charset charset)
Subclasses may ignore this setting.
charset
- the Charset, null resets to the default.public B setCharset(String charset)
Subclasses may ignore this setting.
charset
- the Charset name, null resets to the default.protected B setCharsetDefault(Charset defaultCharset)
Subclasses may ignore this setting.
defaultCharset
- the Charset name, null resets to the default.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.AbstractOriginSupplier.setInputStream(InputStream)
,
AbstractOriginSupplier.setOutputStream(OutputStream)
,
AbstractOriginSupplier.setWriter(Writer)
Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.