Class TcpBufferedOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- org.apache.activemq.transport.tcp.TcpBufferedOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
,TimeStampStream
public class TcpBufferedOutputStream extends FilterOutputStream implements TimeStampStream
An optimized buffered outputstream for Tcp
-
-
Field Summary
-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description TcpBufferedOutputStream(OutputStream out)
ConstructorTcpBufferedOutputStream(OutputStream out, int size)
Creates a new buffered output stream to write data to the specified underlying output stream with the specified buffer size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
close this streamvoid
flush()
flush the data to the output stream This doesn't call flush on the underlying outputstream, because Tcp is particularly efficent at doing this itself ....long
getWriteTimestamp()
boolean
isWriting()
void
write(byte[] b, int off, int len)
write a byte array to the streamvoid
write(int b)
write a byte on to the stream-
Methods inherited from class java.io.FilterOutputStream
write
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
TcpBufferedOutputStream
public TcpBufferedOutputStream(OutputStream out)
Constructor- Parameters:
out
-
-
TcpBufferedOutputStream
public TcpBufferedOutputStream(OutputStream out, int size)
Creates a new buffered output stream to write data to the specified underlying output stream with the specified buffer size.- Parameters:
out
- the underlying output stream.size
- the buffer size.- Throws:
IllegalArgumentException
- if size <= 0.
-
-
Method Detail
-
write
public void write(int b) throws IOException
write a byte on to the stream- Overrides:
write
in classFilterOutputStream
- Parameters:
b
- - byte to write- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException
write a byte array to the stream- Overrides:
write
in classFilterOutputStream
- Parameters:
b
- the byte bufferoff
- the offset into the bufferlen
- the length of data to write- Throws:
IOException
-
flush
public void flush() throws IOException
flush the data to the output stream This doesn't call flush on the underlying outputstream, because Tcp is particularly efficent at doing this itself ....- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classFilterOutputStream
- Throws:
IOException
-
close
public void close() throws IOException
close this stream- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
-
isWriting
public boolean isWriting()
- Specified by:
isWriting
in interfaceTimeStampStream
-
getWriteTimestamp
public long getWriteTimestamp()
- Specified by:
getWriteTimestamp
in interfaceTimeStampStream
-
-