Class TcpBufferedOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.apache.activemq.transport.tcp.TcpBufferedOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,TimeStampStream
An optimized buffered outputstream for Tcp
-
Field Summary
Fields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
ConstructorsConstructorDescriptionConstructorTcpBufferedOutputStream(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
Modifier and TypeMethodDescriptionvoidclose()close this streamvoidflush()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 ....longbooleanvoidwrite(byte[] b, int off, int len) write a byte array to the streamvoidwrite(int b) write a byte on to the streamMethods inherited from class java.io.FilterOutputStream
writeMethods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
TcpBufferedOutputStream
Constructor- Parameters:
out-
-
TcpBufferedOutputStream
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 Details
-
write
write a byte on to the stream- Overrides:
writein classFilterOutputStream- Parameters:
b- - byte to write- Throws:
IOException
-
write
write a byte array to the stream- Overrides:
writein classFilterOutputStream- Parameters:
b- the byte bufferoff- the offset into the bufferlen- the length of data to write- Throws:
IOException
-
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 ....- Specified by:
flushin interfaceFlushable- Overrides:
flushin classFilterOutputStream- Throws:
IOException
-
close
close this stream- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterOutputStream- Throws:
IOException
-
isWriting
public boolean isWriting()- Specified by:
isWritingin interfaceTimeStampStream
-
getWriteTimestamp
public long getWriteTimestamp()- Specified by:
getWriteTimestampin interfaceTimeStampStream
-