org.apache.activemq.transport.tcp
Class TcpBufferedOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by org.apache.activemq.transport.tcp.TcpBufferedOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class TcpBufferedOutputStream
extends java.io.FilterOutputStream

An optimized buffered outputstream for Tcp

Version:
$Revision: 1.1.1.1 $

Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
TcpBufferedOutputStream(java.io.OutputStream out)
          Constructor
TcpBufferedOutputStream(java.io.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
 void close()
          close this stream
 void 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 ....
 void write(byte[] b, int off, int len)
          write a byte array to the stream
 void write(int b)
          write a byte on to the stream
 
Methods inherited from class java.io.FilterOutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TcpBufferedOutputStream

public TcpBufferedOutputStream(java.io.OutputStream out)
Constructor

Parameters:
out -

TcpBufferedOutputStream

public TcpBufferedOutputStream(java.io.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:
java.lang.IllegalArgumentException - if size <= 0.
Method Detail

write

public void write(int b)
           throws java.io.IOException
write a byte on to the stream

Overrides:
write in class java.io.FilterOutputStream
Parameters:
b - - byte to write
Throws:
java.io.IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
write a byte array to the stream

Overrides:
write in class java.io.FilterOutputStream
Parameters:
b - the byte buffer
off - the offset into the buffer
len - the length of data to write
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.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 interface java.io.Flushable
Overrides:
flush in class java.io.FilterOutputStream
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
close this stream

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.FilterOutputStream
Throws:
java.io.IOException


Copyright © 2009 Apache Software Foundation. All Rights Reserved.