public static class RandomAccessFileInputStream.Builder extends AbstractStreamBuilder<RandomAccessFileInputStream,RandomAccessFileInputStream.Builder>
RandomAccessFileInputStream
instance.
For example:
RandomAccessFileInputStream s = RandomAccessFileInputStream.builder()
.setPath(path)
.setCloseOnClose(true)
.get();
Modifier and Type | Field and Description |
---|---|
private boolean |
closeOnClose |
private java.io.RandomAccessFile |
randomAccessFile |
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
RandomAccessFileInputStream |
get()
Constructs a new instance.
|
RandomAccessFileInputStream.Builder |
setCloseOnClose(boolean closeOnClose)
Sets whether to close the underlying file when this stream is closed.
|
RandomAccessFileInputStream.Builder |
setRandomAccessFile(java.io.RandomAccessFile randomAccessFile)
Sets the RandomAccessFile to stream.
|
getBufferSize, getBufferSizeDefault, getCharSequence, getCharset, getCharsetDefault, getInputStream, getOpenOptions, getOutputStream, getPath, getWriter, setBufferSize, setBufferSize, setBufferSizeChecker, setBufferSizeDefault, setBufferSizeMax, setCharset, setCharset, setCharsetDefault, setOpenOptions
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
private java.io.RandomAccessFile randomAccessFile
private boolean closeOnClose
public RandomAccessFileInputStream get() throws java.io.IOException
This builder use the aspects RandomAccessFile or File, and closeOnClose. Only set one of RandomAccessFile or an origin that can be converted to a File.
If RandomAccessFile is not set, then you must provide an origin that can be converted to a File by this builder, otherwise, this call will throw an
UnsupportedOperationException
.
java.lang.IllegalStateException
- if both RandomAccessFile and origin are set.java.lang.UnsupportedOperationException
- if the origin cannot provide a File.java.io.IOException
- if an I/O error occurs.AbstractOrigin.getFile()
public RandomAccessFileInputStream.Builder setCloseOnClose(boolean closeOnClose)
closeOnClose
- Whether to close the underlying file when this stream is closed.public RandomAccessFileInputStream.Builder setRandomAccessFile(java.io.RandomAccessFile randomAccessFile)
randomAccessFile
- the RandomAccessFile to stream.