Package org.agrona.io
Class DirectBufferInputStream
java.lang.Object
java.io.InputStream
org.agrona.io.DirectBufferInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
An
InputStream that wraps a DirectBuffer.-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.DirectBufferInputStream(DirectBuffer buffer) Wrap givenDirectBuffer.DirectBufferInputStream(DirectBuffer buffer, int offset, int length) Wrap givenDirectBuffer. -
Method Summary
Modifier and TypeMethodDescriptionintbuffer()The underlying buffer being wrapped.voidclose()intlength()The length of the underlying buffer to use.booleanintoffset()The offset within the underlying buffer at which to start.intread()intread(byte[] dstBytes, int dstOffset, int length) longskip(long n) voidwrap(DirectBuffer buffer) Wrap givenDirectBuffer.voidwrap(DirectBuffer buffer, int offset, int length) Wrap givenDirectBuffer.Methods inherited from class java.io.InputStream
mark, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skipNBytes, transferTo
-
Constructor Details
-
DirectBufferInputStream
public DirectBufferInputStream()Default constructor. -
DirectBufferInputStream
Wrap givenDirectBuffer.- Parameters:
buffer- to wrap.
-
DirectBufferInputStream
Wrap givenDirectBuffer.- Parameters:
buffer- to wrap.offset- into the buffer.length- in bytes.
-
-
Method Details
-
wrap
Wrap givenDirectBuffer.- Parameters:
buffer- to wrap.
-
wrap
Wrap givenDirectBuffer.- Parameters:
buffer- to wrap.offset- into the buffer.length- in bytes.
-
offset
public int offset()The offset within the underlying buffer at which to start.- Returns:
- offset within the underlying buffer at which to start.
-
length
public int length()The length of the underlying buffer to use.- Returns:
- length of the underlying buffer to use.
-
buffer
The underlying buffer being wrapped.- Returns:
- the underlying buffer being wrapped.
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
available
public int available()- Overrides:
availablein classInputStream
-
skip
public long skip(long n) - Overrides:
skipin classInputStream
-
read
public int read()- Specified by:
readin classInputStream
-
read
public int read(byte[] dstBytes, int dstOffset, int length) - Overrides:
readin classInputStream
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream
-