public static interface FileByteSource.ChannelProvider
Abstract Methods | |
---|---|
Async<AsynchronousFileChannel> |
openChannel()
Open a file channel.
|
void |
closeChannel(AsynchronousFileChannel channel)
Close the channel obtained from a previous
openChannel() call. |
Static Methods | |
FileByteSource.ChannelProvider |
simple(Path file)
Create a simple ChannelProvider that opens/closes a file channel straightforwardly.
|
FileByteSource.ChannelProvider |
pooled(Path file)
Create a pooled ChannelProvider that may return a shared file channel.
|
Async<AsynchronousFileChannel> openChannel()
An implementation may return a shared channel from a pool,
see pooled provider
.
void closeChannel(AsynchronousFileChannel channel)
openChannel()
call.
An implementation may delay the actual closing of the channel,
see pooled provider
.
static FileByteSource.ChannelProvider simple(Path file)
static FileByteSource.ChannelProvider pooled(Path file)
openChannel() may return the same channel to multiple concurrent FileByteSources. This can be beneficial due to reduced system calls, and less system resources used.
The channel will be actually closed after closeChannel()/openChannel() calls are matched.