Package org.apache.qpid.protonj2.buffer
Class ProtonBufferOutputStream
java.lang.Object
java.io.OutputStream
org.apache.qpid.protonj2.buffer.ProtonBufferOutputStream
- All Implemented Interfaces:
Closeable,DataOutput,Flushable,AutoCloseable
ProtonBuffer specialized OutputStream implementation which can be used to adapt
the proton buffer types into code that uses the streams API. This stream wrapper does not take
ownership of the provided buffer and will not close it upon a call to close()
This stream is not thread-safe and should not be used by more than one thread at the same time.
-
Constructor Summary
ConstructorsConstructorDescriptionProtonBufferOutputStream(ProtonBuffer buffer) Create a newOutputStreamwhich wraps the given buffer. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intvoidwrite(byte[] array) voidwrite(byte[] array, int offset, int length) voidwrite(int value) voidwriteBoolean(boolean value) voidwriteByte(int value) voidwriteBytes(String value) voidwriteChar(int value) voidwriteChars(String value) voidwriteDouble(double value) voidwriteFloat(float value) voidwriteInt(int value) voidwriteLong(long value) voidwriteShort(int value) voidMethods inherited from class java.io.OutputStream
flush, nullOutputStream
-
Constructor Details
-
ProtonBufferOutputStream
Create a newOutputStreamwhich wraps the given buffer.- Parameters:
buffer- The buffer that this stream will write to.
-
-
Method Details
-
getBytesWritten
public int getBytesWritten()- Returns:
- a running total of the number of bytes that has been written to this
OutputStream
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
writeBoolean
- Specified by:
writeBooleanin interfaceDataOutput- Throws:
IOException
-
write
- Specified by:
writein interfaceDataOutput- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Specified by:
writein interfaceDataOutput- Overrides:
writein classOutputStream- Throws:
IOException
-
write
- Specified by:
writein interfaceDataOutput- Overrides:
writein classOutputStream- Throws:
IOException
-
writeByte
- Specified by:
writeBytein interfaceDataOutput- Throws:
IOException
-
writeShort
- Specified by:
writeShortin interfaceDataOutput- Throws:
IOException
-
writeChar
- Specified by:
writeCharin interfaceDataOutput- Throws:
IOException
-
writeInt
- Specified by:
writeIntin interfaceDataOutput- Throws:
IOException
-
writeLong
- Specified by:
writeLongin interfaceDataOutput- Throws:
IOException
-
writeFloat
- Specified by:
writeFloatin interfaceDataOutput- Throws:
IOException
-
writeDouble
- Specified by:
writeDoublein interfaceDataOutput- Throws:
IOException
-
writeBytes
- Specified by:
writeBytesin interfaceDataOutput- Throws:
IOException
-
writeChars
- Specified by:
writeCharsin interfaceDataOutput- Throws:
IOException
-
writeUTF
- Specified by:
writeUTFin interfaceDataOutput- Throws:
IOException
-