Class SeekableInMemoryByteChannel
java.lang.Object
org.jboss.shrinkwrap.api.nio2.file.SeekableInMemoryByteChannel
- All Implemented Interfaces:
Closeable, AutoCloseable, ByteChannel, Channel, ReadableByteChannel, SeekableByteChannel, WritableByteChannel
SeekableByteChannel implementation backed by an auto-resizing byte array; thread-safe. Can hold a maximum of
Integer.MAX_VALUE bytes.- Author:
- Andrew Lee Rubinger
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance with 0 size and 0 position, and open. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Obtain a copy of the contents of thisChannelas anInputStreambooleanisOpen()longposition()position(long newPosition) intread(ByteBuffer destination) longsize()truncate(long size) intwrite(ByteBuffer source)
-
Constructor Details
-
SeekableInMemoryByteChannel
public SeekableInMemoryByteChannel()Creates a new instance with 0 size and 0 position, and open.
-
-
Method Details
-
isOpen
-
close
-
read
- Specified by:
readin interfaceReadableByteChannel- Specified by:
readin interfaceSeekableByteChannel- Throws:
IOException- See Also:
-
write
- Specified by:
writein interfaceSeekableByteChannel- Specified by:
writein interfaceWritableByteChannel- Throws:
IOException- See Also:
-
position
public long position()- Specified by:
positionin interfaceSeekableByteChannel- See Also:
-
position
- Specified by:
positionin interfaceSeekableByteChannel- See Also:
-
size
public long size()- Specified by:
sizein interfaceSeekableByteChannel- See Also:
-
truncate
- Specified by:
truncatein interfaceSeekableByteChannel- See Also:
-
getContents
Obtain a copy of the contents of thisChannelas anInputStream
-