public static class RandomAccessFileInputStream.Builder extends org.apache.commons.io.build.AbstractStreamBuilder<RandomAccessFileInputStream,RandomAccessFileInputStream.Builder>
RandomAccessFileInputStream
instance.
For example:
RandomAccessFileInputStream s = RandomAccessFileInputStream.builder()
.setPath(path)
.setCloseOnClose(true)
.get();
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.
|
getCharset, setBufferSize, setBufferSize, setCharset, setCharset, setOpenOptions
setByteArray, setCharSequence, setFile, setFile, setInputStream, setOutputStream, setPath, setPath, setReader, setURI, setWriter
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
asSupplier
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.Copyright © 2010 - 2023 Adobe. All Rights Reserved