Class WrappedSeekableByteChannel
- java.lang.Object
-
- org.epics.archiverappliance.utils.nio.WrappedSeekableByteChannel
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ByteChannel
,Channel
,ReadableByteChannel
,SeekableByteChannel
,WritableByteChannel
public class WrappedSeekableByteChannel extends Object implements SeekableByteChannel
Compressed files typically do not let us seek arbitrarily within the stream. This is a inefficient workaround for this. This can be improved with ZRan like functionality later if needed. This implements a read only seekable byte channel over a one way input stream.- Author:
- mshankar
-
-
Constructor Summary
Constructors Constructor Description WrappedSeekableByteChannel(Path path)
-
Method Summary
Modifier and Type Method Description void
close()
boolean
isOpen()
long
position()
SeekableByteChannel
position(long newPosition)
int
read(ByteBuffer byteBuf)
long
size()
SeekableByteChannel
truncate(long arg0)
int
write(ByteBuffer arg0)
-
-
-
Constructor Detail
-
WrappedSeekableByteChannel
public WrappedSeekableByteChannel(Path path) throws IOException
- Throws:
IOException
-
-
Method Detail
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChannel
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
position
public long position() throws IOException
- Specified by:
position
in interfaceSeekableByteChannel
- Throws:
IOException
-
position
public SeekableByteChannel position(long newPosition) throws IOException
- Specified by:
position
in interfaceSeekableByteChannel
- Throws:
IOException
-
read
public int read(ByteBuffer byteBuf) throws IOException
- Specified by:
read
in interfaceReadableByteChannel
- Specified by:
read
in interfaceSeekableByteChannel
- Throws:
IOException
-
size
public long size() throws IOException
- Specified by:
size
in interfaceSeekableByteChannel
- Throws:
IOException
-
truncate
public SeekableByteChannel truncate(long arg0) throws IOException
- Specified by:
truncate
in interfaceSeekableByteChannel
- Throws:
IOException
-
write
public int write(ByteBuffer arg0) throws IOException
- Specified by:
write
in interfaceSeekableByteChannel
- Specified by:
write
in interfaceWritableByteChannel
- Throws:
IOException
-
-