public static class RandomAccessFileInputStream.Builder extends 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(RandomAccessFile randomAccessFile)
Sets the RandomAccessFile to stream.
|
getBufferSize, getBufferSizeDefault, getCharSequence, getCharset, getCharsetDefault, getInputStream, getOpenOptions, getOutputStream, getPath, getWriter, setBufferSize, setBufferSize, setBufferSizeDefault, setCharset, setCharset, setCharsetDefault, setOpenOptionscheckOrigin, getOrigin, hasOrigin, newByteArrayOrigin, newCharSequenceOrigin, newFileOrigin, newFileOrigin, newInputStreamOrigin, newOutputStreamOrigin, newPathOrigin, newPathOrigin, newReaderOrigin, newURIOrigin, newWriterOrigin, setByteArray, setCharSequence, setFile, setFile, setInputStream, setOrigin, setOutputStream, setPath, setPath, setReader, setURI, setWriterasThisclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasSupplierpublic Builder()
public RandomAccessFileInputStream get() throws 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.
IllegalStateException - if both RandomAccessFile and origin are set.UnsupportedOperationException - if the origin cannot provide a File.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(RandomAccessFile randomAccessFile)
randomAccessFile - the RandomAccessFile to stream.Copyright © 2002–2023 The Apache Software Foundation. All rights reserved.