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
.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.DirectBufferInputStream
(DirectBuffer buffer) Wrap givenDirectBuffer
.DirectBufferInputStream
(DirectBuffer buffer, int offset, int length) Wrap givenDirectBuffer
. -
Method Summary
Modifier and TypeMethodDescriptionint
buffer()
The underlying buffer being wrapped.void
close()
int
length()
The length of the underlying buffer to use.boolean
int
offset()
The offset within the underlying buffer at which to start.int
read()
int
read
(byte[] dstBytes, int dstOffset, int length) long
skip
(long n) void
wrap
(DirectBuffer buffer) Wrap givenDirectBuffer
.void
wrap
(DirectBuffer buffer, int offset, int length) Wrap givenDirectBuffer
.Methods inherited from class java.io.InputStream
mark, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skipNBytes, transferTo
-
Field Details
-
buffer
-
offset
private int offset -
length
private int length -
position
private int position
-
-
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:
markSupported
in classInputStream
-
available
public int available()- Overrides:
available
in classInputStream
-
skip
public long skip(long n) - Overrides:
skip
in classInputStream
-
read
public int read()- Specified by:
read
in classInputStream
-
read
public int read(byte[] dstBytes, int dstOffset, int length) - Overrides:
read
in classInputStream
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
-