Class FramedBufferInputStream
- java.lang.Object
-
- java.io.InputStream
-
- net.morimekta.providence.thrift.io.FramedBufferInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class FramedBufferInputStream extends java.io.InputStream
Wrap an input stream in a framed buffer reader similar to the thrift TFramedTransport. The input stream will read one whole frame from the byte channel regardless of how many bytes are read, but can be reset at the end
-
-
Constructor Summary
Constructors Constructor Description FramedBufferInputStream(java.nio.channels.ReadableByteChannel in)
FramedBufferInputStream(java.nio.channels.ReadableByteChannel in, int maxFrameSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
nextFrame()
Skip the rest of the current frame, regardless of how much has bean read / used.int
read()
int
read(byte[] data)
int
read(byte[] data, int off, int len)
-
-
-
Method Detail
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(@Nonnull byte[] data) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(@Nonnull byte[] data, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOException
- Overrides:
available
in classjava.io.InputStream
- Throws:
java.io.IOException
-
nextFrame
public void nextFrame()
Skip the rest of the current frame, regardless of how much has bean read / used.
-
-