public static class BufferedFileChannelInputStream.Builder extends AbstractStreamBuilder<BufferedFileChannelInputStream,BufferedFileChannelInputStream.Builder>
BufferedFileChannelInputStream.
Using File IO:
BufferedFileChannelInputStream s = BufferedFileChannelInputStream.builder()
.setFile(file)
.setBufferSize(4096)
.get();
Using NIO Path:
BufferedFileChannelInputStream s = BufferedFileChannelInputStream.builder()
.setPath(path)
.setBufferSize(4096)
.get();
get()| Constructor and Description |
|---|
Builder()
Constructs a new builder of
BufferedFileChannelInputStream. |
| Modifier and Type | Method and Description |
|---|---|
BufferedFileChannelInputStream |
get()
Builds a new
BufferedFileChannelInputStream. |
BufferedFileChannelInputStream.Builder |
setFileChannel(FileChannel fileChannel)
Sets the file channel.
|
getBufferSize, getBufferSizeDefault, getCharSequence, getCharset, getCharsetDefault, getFile, getInputStream, getOpenOptions, getOutputStream, getPath, getRandomAccessFile, getReader, getWriter, setBufferSize, setBufferSize, setBufferSizeChecker, setBufferSizeDefault, setBufferSizeMax, setCharset, setCharset, setCharsetDefault, setOpenOptionscheckOrigin, 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, getUncheckedpublic Builder()
BufferedFileChannelInputStream.public BufferedFileChannelInputStream get() throws IOException
BufferedFileChannelInputStream.
You must set an aspect that supports AbstractStreamBuilder.getInputStream(), otherwise, this method throws an exception.
This builder uses the following aspects:
FileChannel takes precedence is set. AbstractStreamBuilder.getPath() if the file channel is not set.AbstractStreamBuilder.getBufferSize()IllegalStateException - if the origin is null.UnsupportedOperationException - if the origin cannot be converted to a Path.IOException - if an I/O error occurs converting to an Path using AbstractStreamBuilder.getPath().AbstractStreamBuilder.getPath(),
AbstractStreamBuilder.getBufferSize(),
IOSupplier.getUnchecked()public BufferedFileChannelInputStream.Builder setFileChannel(FileChannel fileChannel)
This setting takes precedence over all others.
fileChannel - the file channel.