Package org.apache.commons.io.input
Class BufferedFileChannelInputStream.Builder
- java.lang.Object
-
- org.apache.commons.io.build.AbstractSupplier<T,B>
-
- org.apache.commons.io.build.AbstractOriginSupplier<T,B>
-
- 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 newBufferedFileChannelInputStream.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:
get()
-
-
Constructor Summary
Constructors Constructor Description Builder()Constructs a new builder ofBufferedFileChannelInputStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BufferedFileChannelInputStreamget()Builds a newBufferedFileChannelInputStream.BufferedFileChannelInputStream.BuildersetFileChannel(java.nio.channels.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, setBufferSizeMax, setCharset, setCharset, setOpenOptions
-
Methods inherited from class org.apache.commons.io.build.AbstractOriginSupplier
setByteArray, setCharSequence, setFile, setFile, setInputStream, setOutputStream, setPath, setPath, setRandomAccessFile, setRandomAccessFile, setReader, setURI, setWriter
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.io.function.IOSupplier
asSupplier, getUnchecked
-
-
-
-
Constructor Detail
-
Builder
public Builder()
Constructs a new builder ofBufferedFileChannelInputStream.
-
-
Method Detail
-
get
public BufferedFileChannelInputStream get() throws java.io.IOException
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:
java.lang.IllegalStateException- if theoriginisnull.java.lang.UnsupportedOperationException- if the origin cannot be converted to aPath.java.io.IOException- if an I/O error occurs converting to anPathusingAbstractStreamBuilder.getPath().- See Also:
AbstractStreamBuilder.getPath(),AbstractStreamBuilder.getBufferSize(),IOSupplier.getUnchecked()
-
setFileChannel
public BufferedFileChannelInputStream.Builder setFileChannel(java.nio.channels.FileChannel fileChannel)
Sets the file channel.This setting takes precedence over all others.
- Parameters:
fileChannel- the file channel.- Returns:
- this instance.
- Since:
- 2.18.0
-
-