hypercast
Class HCastOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--hypercast.HCastOutputStream

public class HCastOutputStream
extends java.io.OutputStream

This is the class used to send the byte array through stream manager


Constructor Summary
HCastOutputStream(hypercast.StreamManager sm, byte[] streamID)
          Constructs an HCastOutputStream with a StreamManager and a stream id.
 
Method Summary
 void close()
          remove the stream id from the hashtable.
 void flush()
          Flushes this output stream and forces any buffered output bytes to be written out.
 byte getDeliveryMode()
          Returns the current delivery mode for outgoing messages (DELIVERY_MODE_FLOOD, DELIVERY_MODE_MULTICAST, DELIVERY_MODE_UNICAST, DELIVERY_MODE_INVALID).
 int getStreamID()
          Deprecated. use getStreamIdentifier
 int getStreamIdentifier()
           
 boolean hasSent()
           
 void reset()
          reset the message sending flag
 void setBroadcast()
          Sets the delivery mode for all outgoing messages to multicast.
 void setFlood()
          Sets the delivery mode for all outgoing messages to flooding.
 void setHopLimit(short hopLimit)
          Sets the hop-length field of outgoing messages to the specified value.
 void setSendFlood()
          Deprecated. use setFlood
 void setSendToAll()
          Deprecated. use setBroadcast
 void setSendToUnicast(hypercast.I_LogicalAddress Laddr)
          Deprecated. use setUnicast
 void setUnicast(hypercast.I_LogicalAddress Laddr)
          Sets the delivery mode for all outgoing messages to unicast with the specified logical address as destination.
 void write(byte b)
          Writes one byte this output stream.
 void write(byte[] b)
          Writes b.length bytes from the specified byte array to this output stream.
 void write(byte[] b, int off, int len)
          Writes len bytes from the specified byte array starting at offset off to this output stream.
 void write(int b)
          Writes one byte (passed as a integer) to this output stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HCastOutputStream

public HCastOutputStream(hypercast.StreamManager sm,
                         byte[] streamID)
Constructs an HCastOutputStream with a StreamManager and a stream id.

Parameters:
sm - StreamManager
streamID - Stream id
Method Detail

flush

public void flush()
           throws java.io.IOException
Flushes this output stream and forces any buffered output bytes to be written out.

Overrides:
flush in class java.io.OutputStream
java.io.IOException

close

public void close()
           throws java.io.IOException
remove the stream id from the hashtable.

Overrides:
close in class java.io.OutputStream
java.io.IOException

write

public void write(byte[] b)
           throws java.io.IOException
Writes b.length bytes from the specified byte array to this output stream.

Overrides:
write in class java.io.OutputStream
java.io.IOException

write

public void write(int b)
           throws java.io.IOException
Writes one byte (passed as a integer) to this output stream. This method is defined in java.io.OutputStream and needs to be overrided in this class.

Specified by:
write in class java.io.OutputStream
java.io.IOException

write

public void write(byte b)
           throws java.io.IOException
Writes one byte this output stream.

java.io.IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Writes len bytes from the specified byte array starting at offset off to this output stream.

Overrides:
write in class java.io.OutputStream
java.io.IOException

getStreamID

public int getStreamID()
Deprecated. use getStreamIdentifier

Returns:
stream id

getStreamIdentifier

public int getStreamIdentifier()
Returns:
stream id

setSendToUnicast

public void setSendToUnicast(hypercast.I_LogicalAddress Laddr)
Deprecated. use setUnicast

Sets the delivery mode for all outgoing messages to unicast with the specified logical address as destination.


setUnicast

public void setUnicast(hypercast.I_LogicalAddress Laddr)
Sets the delivery mode for all outgoing messages to unicast with the specified logical address as destination.


setSendToAll

public void setSendToAll()
Deprecated. use setBroadcast

Sets the delivery mode for all outgoing messages to multicast.


setBroadcast

public void setBroadcast()
Sets the delivery mode for all outgoing messages to multicast.


setSendFlood

public void setSendFlood()
Deprecated. use setFlood

Sets the delivery mode for all outgoing messages to flooding.


setFlood

public void setFlood()
Sets the delivery mode for all outgoing messages to flooding.


getDeliveryMode

public byte getDeliveryMode()
Returns the current delivery mode for outgoing messages (DELIVERY_MODE_FLOOD, DELIVERY_MODE_MULTICAST, DELIVERY_MODE_UNICAST, DELIVERY_MODE_INVALID).


setHopLimit

public void setHopLimit(short hopLimit)
Sets the hop-length field of outgoing messages to the specified value.


hasSent

public boolean hasSent()
Returns:
the message sending flag

reset

public void reset()
reset the message sending flag