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
ConstructorDescriptionProtonBufferOutputStream
(ProtonBuffer buffer) Create a newOutputStream
which wraps the given buffer. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
int
void
write
(byte[] array) void
write
(byte[] array, int offset, int length) void
write
(int value) void
writeBoolean
(boolean value) void
writeByte
(int value) void
writeBytes
(String value) void
writeChar
(int value) void
writeChars
(String value) void
writeDouble
(double value) void
writeFloat
(float value) void
writeInt
(int value) void
writeLong
(long value) void
writeShort
(int value) void
Methods inherited from class java.io.OutputStream
flush, nullOutputStream
-
Constructor Details
-
ProtonBufferOutputStream
Create a newOutputStream
which 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
writeBoolean
- Specified by:
writeBoolean
in interfaceDataOutput
- Throws:
IOException
-
write
- Specified by:
write
in interfaceDataOutput
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
- Specified by:
write
in interfaceDataOutput
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
- Specified by:
write
in interfaceDataOutput
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
writeByte
- Specified by:
writeByte
in interfaceDataOutput
- Throws:
IOException
-
writeShort
- Specified by:
writeShort
in interfaceDataOutput
- Throws:
IOException
-
writeChar
- Specified by:
writeChar
in interfaceDataOutput
- Throws:
IOException
-
writeInt
- Specified by:
writeInt
in interfaceDataOutput
- Throws:
IOException
-
writeLong
- Specified by:
writeLong
in interfaceDataOutput
- Throws:
IOException
-
writeFloat
- Specified by:
writeFloat
in interfaceDataOutput
- Throws:
IOException
-
writeDouble
- Specified by:
writeDouble
in interfaceDataOutput
- Throws:
IOException
-
writeBytes
- Specified by:
writeBytes
in interfaceDataOutput
- Throws:
IOException
-
writeChars
- Specified by:
writeChars
in interfaceDataOutput
- Throws:
IOException
-
writeUTF
- Specified by:
writeUTF
in interfaceDataOutput
- Throws:
IOException
-