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
public class ProtonBufferOutputStream extends OutputStream implements DataOutput
ProtonBuffer
specializedOutputStream
implementation which can be used to adapt the proton buffer types into code that uses the streams API.
-
-
Constructor Summary
Constructors Constructor Description ProtonBufferOutputStream(ProtonBuffer buffer)
Create a newOutputStream
which wraps the given buffer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
int
getBytesWritten()
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
writeUTF(String value)
-
Methods inherited from class java.io.OutputStream
flush, nullOutputStream
-
-
-
-
Constructor Detail
-
ProtonBufferOutputStream
public ProtonBufferOutputStream(ProtonBuffer buffer)
Create a newOutputStream
which wraps the given buffer.- Parameters:
buffer
- The buffer that this stream will write to.
-
-
Method Detail
-
getBytesWritten
public int getBytesWritten()
- Returns:
- a running total of the number of bytes that has been written to this
OutputStream
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
writeBoolean
public void writeBoolean(boolean value) throws IOException
- Specified by:
writeBoolean
in interfaceDataOutput
- Throws:
IOException
-
write
public void write(int value) throws IOException
- Specified by:
write
in interfaceDataOutput
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] array, int offset, int length) throws IOException
- Specified by:
write
in interfaceDataOutput
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] array) throws IOException
- Specified by:
write
in interfaceDataOutput
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
writeByte
public void writeByte(int value) throws IOException
- Specified by:
writeByte
in interfaceDataOutput
- Throws:
IOException
-
writeShort
public void writeShort(int value) throws IOException
- Specified by:
writeShort
in interfaceDataOutput
- Throws:
IOException
-
writeChar
public void writeChar(int value) throws IOException
- Specified by:
writeChar
in interfaceDataOutput
- Throws:
IOException
-
writeInt
public void writeInt(int value) throws IOException
- Specified by:
writeInt
in interfaceDataOutput
- Throws:
IOException
-
writeLong
public void writeLong(long value) throws IOException
- Specified by:
writeLong
in interfaceDataOutput
- Throws:
IOException
-
writeFloat
public void writeFloat(float value) throws IOException
- Specified by:
writeFloat
in interfaceDataOutput
- Throws:
IOException
-
writeDouble
public void writeDouble(double value) throws IOException
- Specified by:
writeDouble
in interfaceDataOutput
- Throws:
IOException
-
writeBytes
public void writeBytes(String value) throws IOException
- Specified by:
writeBytes
in interfaceDataOutput
- Throws:
IOException
-
writeChars
public void writeChars(String value) throws IOException
- Specified by:
writeChars
in interfaceDataOutput
- Throws:
IOException
-
writeUTF
public void writeUTF(String value) throws IOException
- Specified by:
writeUTF
in interfaceDataOutput
- Throws:
IOException
-
-