Package org.apache.commons.io.input
Class BufferedFileChannelInputStream.Builder
java.lang.Object
org.apache.commons.io.build.AbstractSupplier<BufferedFileChannelInputStream,BufferedFileChannelInputStream.Builder>
org.apache.commons.io.build.AbstractOriginSupplier<BufferedFileChannelInputStream,BufferedFileChannelInputStream.Builder>
org.apache.commons.io.build.AbstractStreamBuilder<BufferedFileChannelInputStream,BufferedFileChannelInputStream.Builder>
org.apache.commons.io.input.BufferedFileChannelInputStream.Builder
- All Implemented Interfaces:
IOSupplier<BufferedFileChannelInputStream>
- Enclosing class:
BufferedFileChannelInputStream
public static class BufferedFileChannelInputStream.Builder
extends AbstractStreamBuilder<BufferedFileChannelInputStream,BufferedFileChannelInputStream.Builder>
Builds a new
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();
- Since:
- 2.12.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget()Builds a newBufferedFileChannelInputStream.setFileChannel(FileChannel fileChannel) Sets the file channel.Methods inherited from class org.apache.commons.io.build.AbstractStreamBuilder
getBufferSize, getBufferSizeDefault, getCharSequence, getCharset, getCharsetDefault, getFile, getInputStream, getOpenOptions, getOutputStream, getPath, getRandomAccessFile, getReader, getWriter, setBufferSize, setBufferSize, setBufferSizeChecker, setBufferSizeDefault, setBufferSizeMax, setCharset, setCharset, setCharsetDefault, setOpenOptionsMethods inherited from class org.apache.commons.io.build.AbstractOriginSupplier
checkOrigin, 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, setWriterMethods inherited from class org.apache.commons.io.build.AbstractSupplier
asThisMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.io.function.IOSupplier
asSupplier, getUnchecked
-
Constructor Details
-
Builder
public Builder()Constructs a new builder ofBufferedFileChannelInputStream.
-
-
Method Details
-
get
Builds a newBufferedFileChannelInputStream.You must set an aspect that supports
AbstractStreamBuilder.getInputStream(), otherwise, this method throws an exception.This builder uses the following aspects:
FileChanneltakes precedence is set.AbstractStreamBuilder.getPath()if the file channel is not set.AbstractStreamBuilder.getBufferSize()
- Returns:
- a new instance.
- Throws:
IllegalStateException- if theoriginisnull.UnsupportedOperationException- if the origin cannot be converted to aPath.IOException- if an I/O error occurs converting to anPathusingAbstractStreamBuilder.getPath().- See Also:
-
setFileChannel
Sets the file channel.This setting takes precedence over all others.
- Parameters:
fileChannel- the file channel.- Returns:
- this instance.
- Since:
- 2.18.0
-