Package org.apache.qpid.protonj2.buffer
Class ProtonBufferInputStream
java.lang.Object
java.io.InputStream
org.apache.qpid.protonj2.buffer.ProtonBufferInputStream
- All Implemented Interfaces:
Closeable
,DataInput
,AutoCloseable
An InputStream that can be used to adapt a
ProtonBuffer
for use in the
standard streams API. This stream wrapper assumes ownership of the provided stream
and will close it upon a call to the close()
method.-
Constructor Summary
ConstructorDescriptionProtonBufferInputStream
(ProtonBuffer buffer) Creates a newInputStream
instance that wraps the givenProtonBuffer
and assumes ownership. -
Method Summary
Modifier and TypeMethodDescriptionint
void
close()
int
void
mark
(int readlimit) boolean
int
read()
int
read
(byte[] b, int off, int len) boolean
byte
readByte()
char
readChar()
double
float
void
readFully
(byte[] target) void
readFully
(byte[] target, int offset, int length) int
readInt()
readLine()
long
readLong()
short
int
int
readUTF()
void
reset()
long
skip
(long skipAmount) int
skipBytes
(int skipAmount) Methods inherited from class java.io.InputStream
nullInputStream, read, readAllBytes, readNBytes, readNBytes, transferTo
-
Constructor Details
-
ProtonBufferInputStream
Creates a newInputStream
instance that wraps the givenProtonBuffer
and assumes ownership.- Parameters:
buffer
- TheProtonBuffer
that thisInputStream
will read from.
-
-
Method Details
-
getBytesRead
public int getBytesRead()- Returns:
- a running total of the number of bytes that has been read from this
InputStream
.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
available
- Overrides:
available
in classInputStream
- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
mark
in classInputStream
-
reset
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classInputStream
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
skipBytes
- Specified by:
skipBytes
in interfaceDataInput
- Throws:
IOException
-
readFully
- Specified by:
readFully
in interfaceDataInput
- Throws:
IOException
-
readFully
- Specified by:
readFully
in interfaceDataInput
- Throws:
IOException
-
readBoolean
- Specified by:
readBoolean
in interfaceDataInput
- Throws:
IOException
-
readByte
- Specified by:
readByte
in interfaceDataInput
- Throws:
IOException
-
readUnsignedByte
- Specified by:
readUnsignedByte
in interfaceDataInput
- Throws:
IOException
-
readShort
- Specified by:
readShort
in interfaceDataInput
- Throws:
IOException
-
readUnsignedShort
- Specified by:
readUnsignedShort
in interfaceDataInput
- Throws:
IOException
-
readChar
- Specified by:
readChar
in interfaceDataInput
- Throws:
IOException
-
readInt
- Specified by:
readInt
in interfaceDataInput
- Throws:
IOException
-
readLong
- Specified by:
readLong
in interfaceDataInput
- Throws:
IOException
-
readFloat
- Specified by:
readFloat
in interfaceDataInput
- Throws:
IOException
-
readDouble
- Specified by:
readDouble
in interfaceDataInput
- Throws:
IOException
-
readLine
- Specified by:
readLine
in interfaceDataInput
- Throws:
IOException
-
readUTF
- Specified by:
readUTF
in interfaceDataInput
- Throws:
IOException
-