Class SeekableInMemoryByteChannel
- java.lang.Object
-
- org.jboss.shrinkwrap.api.nio.file.SeekableInMemoryByteChannel
-
- All Implemented Interfaces:
Closeable,AutoCloseable,ByteChannel,Channel,ReadableByteChannel,SeekableByteChannel,WritableByteChannel
public class SeekableInMemoryByteChannel extends Object implements SeekableByteChannel
SeekableByteChannelimplementation backed by an auto-resizing byte array; thread-safe. Can hold a maxiumum ofInteger.MAX_VALUEbytes.- Author:
- Andrew Lee Rubinger
-
-
Constructor Summary
Constructors Constructor Description SeekableInMemoryByteChannel()Creates a new instance with 0 size and 0 position, and open.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanisOpen()longposition()SeekableByteChannelposition(long newPosition)intread(ByteBuffer destination)longsize()SeekableByteChanneltruncate(long size)intwrite(ByteBuffer source)
-
-
-
Method Detail
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin interfaceChannel- See Also:
Channel.isOpen()
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException- See Also:
Channel.close()
-
read
public int read(ByteBuffer destination) throws IOException
- Specified by:
readin interfaceReadableByteChannel- Specified by:
readin interfaceSeekableByteChannel- Throws:
IOException- See Also:
SeekableByteChannel.read(java.nio.ByteBuffer)
-
write
public int write(ByteBuffer source) throws IOException
- Specified by:
writein interfaceSeekableByteChannel- Specified by:
writein interfaceWritableByteChannel- Throws:
IOException- See Also:
SeekableByteChannel.write(java.nio.ByteBuffer)
-
position
public long position() throws IOException- Specified by:
positionin interfaceSeekableByteChannel- Throws:
IOException- See Also:
SeekableByteChannel.position()
-
position
public SeekableByteChannel position(long newPosition) throws IOException
- Specified by:
positionin interfaceSeekableByteChannel- Throws:
IOException- See Also:
SeekableByteChannel.position(long)
-
size
public long size() throws IOException- Specified by:
sizein interfaceSeekableByteChannel- Throws:
IOException- See Also:
SeekableByteChannel.size()
-
truncate
public SeekableByteChannel truncate(long size) throws IOException
- Specified by:
truncatein interfaceSeekableByteChannel- Throws:
IOException- See Also:
SeekableByteChannel.truncate(long)
-
-