public class MultiReadOnlySeekableByteChannel extends Object implements SeekableByteChannel
SeekableByteChannel that
concatenates a collection of other SeekableByteChannels.
This is a lose port of MultiReadOnlySeekableByteChannel by Tim Underwood.
| Constructor and Description |
|---|
MultiReadOnlySeekableByteChannel(List<SeekableByteChannel> channels)
Concatenates the given channels.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static SeekableByteChannel |
forFiles(File... files)
Concatenates the given files.
|
static SeekableByteChannel |
forSeekableByteChannels(SeekableByteChannel... channels)
Concatenates the given channels.
|
boolean |
isOpen() |
long |
position() |
SeekableByteChannel |
position(long newPosition) |
int |
read(ByteBuffer dst) |
long |
size() |
SeekableByteChannel |
truncate(long size) |
int |
write(ByteBuffer src) |
public MultiReadOnlySeekableByteChannel(List<SeekableByteChannel> channels)
channels - the channels to concatenateNullPointerException - if channels is nullpublic int read(ByteBuffer dst) throws IOException
read in interface ReadableByteChannelread in interface SeekableByteChannelIOExceptionpublic void close() throws IOException
close in interface Closeableclose in interface AutoCloseableclose in interface ChannelIOExceptionpublic long position()
position in interface SeekableByteChannelpublic long size() throws IOException
size in interface SeekableByteChannelIOExceptionpublic SeekableByteChannel truncate(long size)
truncate in interface SeekableByteChannelNonWritableChannelException - since this implementation is read-only.public int write(ByteBuffer src)
write in interface SeekableByteChannelwrite in interface WritableByteChannelNonWritableChannelException - since this implementation is read-only.public SeekableByteChannel position(long newPosition) throws IOException
position in interface SeekableByteChannelIOExceptionpublic static SeekableByteChannel forSeekableByteChannels(SeekableByteChannel... channels)
channels - the channels to concatenateNullPointerException - if channels is nullpublic static SeekableByteChannel forFiles(File... files) throws IOException
files - the files to concatenateNullPointerException - if files is nullIOException - if opening a channel for one of the files failsCopyright © 2019 The Apache Software Foundation. All rights reserved.