Package org.apache.qpid.protonj2.buffer
Class ProtonBufferOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.qpid.protonj2.buffer.ProtonBufferOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.DataOutput
,java.io.Flushable
,java.lang.AutoCloseable
public class ProtonBufferOutputStream extends java.io.OutputStream implements java.io.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(java.lang.String value)
void
writeChar(int value)
void
writeChars(java.lang.String value)
void
writeDouble(double value)
void
writeFloat(float value)
void
writeInt(int value)
void
writeLong(long value)
void
writeShort(int value)
void
writeUTF(java.lang.String value)
-
-
-
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 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
-
writeBoolean
public void writeBoolean(boolean value) throws java.io.IOException
- Specified by:
writeBoolean
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
write
public void write(int value) throws java.io.IOException
- Specified by:
write
in interfacejava.io.DataOutput
- Specified by:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] array, int offset, int length) throws java.io.IOException
- Specified by:
write
in interfacejava.io.DataOutput
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] array) throws java.io.IOException
- Specified by:
write
in interfacejava.io.DataOutput
- Overrides:
write
in classjava.io.OutputStream
- Throws:
java.io.IOException
-
writeByte
public void writeByte(int value) throws java.io.IOException
- Specified by:
writeByte
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeShort
public void writeShort(int value) throws java.io.IOException
- Specified by:
writeShort
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeChar
public void writeChar(int value) throws java.io.IOException
- Specified by:
writeChar
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeInt
public void writeInt(int value) throws java.io.IOException
- Specified by:
writeInt
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeLong
public void writeLong(long value) throws java.io.IOException
- Specified by:
writeLong
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeFloat
public void writeFloat(float value) throws java.io.IOException
- Specified by:
writeFloat
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeDouble
public void writeDouble(double value) throws java.io.IOException
- Specified by:
writeDouble
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeBytes
public void writeBytes(java.lang.String value) throws java.io.IOException
- Specified by:
writeBytes
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeChars
public void writeChars(java.lang.String value) throws java.io.IOException
- Specified by:
writeChars
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
writeUTF
public void writeUTF(java.lang.String value) throws java.io.IOException
- Specified by:
writeUTF
in interfacejava.io.DataOutput
- Throws:
java.io.IOException
-
-