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
public class ProtonBufferInputStream extends InputStream implements DataInput
An InputStream that can be used to adapt aProtonBuffer
for use in the standard streams API.
-
-
Constructor Summary
Constructors Constructor Description ProtonBufferInputStream(ProtonBuffer buffer)
Creates a newInputStream
instance that wraps the givenProtonBuffer
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
int
getBytesRead()
void
mark(int readlimit)
boolean
markSupported()
int
read()
int
read(byte[] b, int off, int len)
boolean
readBoolean()
byte
readByte()
char
readChar()
double
readDouble()
float
readFloat()
void
readFully(byte[] target)
void
readFully(byte[] target, int offset, int length)
int
readInt()
String
readLine()
long
readLong()
short
readShort()
int
readUnsignedByte()
int
readUnsignedShort()
String
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 Detail
-
ProtonBufferInputStream
public ProtonBufferInputStream(ProtonBuffer buffer)
Creates a newInputStream
instance that wraps the givenProtonBuffer
- Parameters:
buffer
- TheProtonBuffer
that thisInputStream
will read from.
-
-
Method Detail
-
getBytesRead
public int getBytesRead()
- Returns:
- a running total of the number of bytes that has been read from this
InputStream
.
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
available
public int available() throws IOException
- Overrides:
available
in classInputStream
- Throws:
IOException
-
mark
public void mark(int readlimit)
- Overrides:
mark
in classInputStream
-
reset
public void reset() throws IOException
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classInputStream
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
skip
public long skip(long skipAmount) throws IOException
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
skipBytes
public int skipBytes(int skipAmount) throws IOException
- Specified by:
skipBytes
in interfaceDataInput
- Throws:
IOException
-
readFully
public void readFully(byte[] target) throws IOException
- Specified by:
readFully
in interfaceDataInput
- Throws:
IOException
-
readFully
public void readFully(byte[] target, int offset, int length) throws IOException
- Specified by:
readFully
in interfaceDataInput
- Throws:
IOException
-
readBoolean
public boolean readBoolean() throws IOException
- Specified by:
readBoolean
in interfaceDataInput
- Throws:
IOException
-
readByte
public byte readByte() throws IOException
- Specified by:
readByte
in interfaceDataInput
- Throws:
IOException
-
readUnsignedByte
public int readUnsignedByte() throws IOException
- Specified by:
readUnsignedByte
in interfaceDataInput
- Throws:
IOException
-
readShort
public short readShort() throws IOException
- Specified by:
readShort
in interfaceDataInput
- Throws:
IOException
-
readUnsignedShort
public int readUnsignedShort() throws IOException
- Specified by:
readUnsignedShort
in interfaceDataInput
- Throws:
IOException
-
readChar
public char readChar() throws IOException
- Specified by:
readChar
in interfaceDataInput
- Throws:
IOException
-
readInt
public int readInt() throws IOException
- Specified by:
readInt
in interfaceDataInput
- Throws:
IOException
-
readLong
public long readLong() throws IOException
- Specified by:
readLong
in interfaceDataInput
- Throws:
IOException
-
readFloat
public float readFloat() throws IOException
- Specified by:
readFloat
in interfaceDataInput
- Throws:
IOException
-
readDouble
public double readDouble() throws IOException
- Specified by:
readDouble
in interfaceDataInput
- Throws:
IOException
-
readLine
public String readLine() throws IOException
- Specified by:
readLine
in interfaceDataInput
- Throws:
IOException
-
readUTF
public String readUTF() throws IOException
- Specified by:
readUTF
in interfaceDataInput
- Throws:
IOException
-
-