Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

nectar.reda.io
Class RedaOutputStream  view RedaOutputStream download RedaOutputStream.java

java.lang.Object
  extended byjava.io.OutputStream
      extended bynectar.reda.io.RedaOutputStream

public class RedaOutputStream
extends java.io.OutputStream


Field Summary
private  byte[] buff
           
private  RedaConnection connection
           
private static int MAX_BUFFER_SIZE
           
private  int pos
           
 
Constructor Summary
RedaOutputStream(RedaConnection connection)
          Creates a new instance of ReadOutputStream
 
Method Summary
 void close()
          This method doesn't do anything.
 void flush()
          Flush the buffered bytes in this stream and actually write all of them out to the underlying connection.
 void write(byte[] b)
          This method all the writes bytes from the passed array to the output stream.
 void write(byte[] src, int off, int len)
          write a byte array to the underlying RedaConnection, which will compress and encrypt it.
 void write(int param)
          This method writes a single byte to the output stream.
private  void writeToConnection(byte[] src, int off, int len)
          write a byte array to the underlying RedaConnection, which will compress and encrypt it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection

private RedaConnection connection

buff

private byte[] buff

pos

private int pos

MAX_BUFFER_SIZE

private static int MAX_BUFFER_SIZE
Constructor Detail

RedaOutputStream

public RedaOutputStream(RedaConnection connection)
Creates a new instance of ReadOutputStream

Method Detail

writeToConnection

private void writeToConnection(byte[] src,
                               int off,
                               int len)
                        throws java.io.IOException
write a byte array to the underlying RedaConnection, which will compress and encrypt it. if the byte array is larger than RedaConnection.MAX_PACKET_SIZE, this method will segment the packet before sending it out.


write

public void write(byte[] src,
                  int off,
                  int len)
           throws java.io.IOException
write a byte array to the underlying RedaConnection, which will compress and encrypt it. you must call the flush() method on this InputStream to actually write the data out to the connection. this method is lazy and buffers data until MAX_PACKET_SIZE is reached, at which point it will flush it's buffer to the connection.


write

public void write(int param)
           throws java.io.IOException
Description copied from class: java.io.OutputStream
This method writes a single byte to the output stream. The byte written is the low eight bits of the int passed and a argument.

Subclasses must provide an implementation of this abstract method


write

public void write(byte[] b)
           throws java.io.IOException
Description copied from class: java.io.OutputStream
This method all the writes bytes from the passed array to the output stream. This method is equivalent to write(b, 0, buf.length) which is exactly how it is implemented in this class.


flush

public void flush()
           throws java.io.IOException
Flush the buffered bytes in this stream and actually write all of them out to the underlying connection.


close

public void close()
           throws java.io.IOException
This method doesn't do anything. To disconnect, use the RecordConnection.disconnect() method.