Class FramedBufferOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- net.morimekta.providence.thrift.io.FramedBufferOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public class FramedBufferOutputStream extends java.io.OutputStream
Wrap an output stream in a framed buffer writer similar to the thrift TFramedTransport. The output stream will write everything in one single block when it is closed.
-
-
Constructor Summary
Constructors Constructor Description FramedBufferOutputStream(java.nio.channels.WritableByteChannel out)
FramedBufferOutputStream(java.nio.channels.WritableByteChannel out, int maxBufferSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
completeFrame()
Write the frame at the current state, and reset the buffer to be able to generate a new frame.void
write(byte[] bytes)
void
write(byte[] var1, int off, int len)
void
write(int val)
-
-
-
Method Detail
-
write
public void write(int val) throws java.io.IOException
- Specified by:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(@Nonnull byte[] bytes) throws java.io.IOException
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(@Nonnull byte[] var1, int off, int len) throws java.io.IOException
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
completeFrame
public void completeFrame() throws java.io.IOException
Write the frame at the current state, and reset the buffer to be able to generate a new frame.- Throws:
java.io.IOException
- On failed write.
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
-