fr.dyade.aaa.agent
Class UDPNetwork.DatagramOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by fr.dyade.aaa.agent.MessageOutputStream
          extended by fr.dyade.aaa.agent.UDPNetwork.DatagramOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable
Enclosing class:
UDPNetwork

final class UDPNetwork.DatagramOutputStream
extends MessageOutputStream

Class used to send messages with UDP packets.


Field Summary
private  byte[] ackBuf
           
private  int datagramStamp
           
private  byte[] handshakeBuf
           
private  java.net.SocketAddress serverAddr
           
private  UDPNetwork.ServerInfo serverInfo
           
private  int size
           
 
Fields inherited from class fr.dyade.aaa.agent.MessageOutputStream
buf, compressedFlows, count, logmon, oos
 
Constructor Summary
UDPNetwork.DatagramOutputStream()
           
 
Method Summary
(package private)  void handShake(java.net.SocketAddress addr)
           
private  void sendPacket()
           
 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 the specified byte to this output stream.
(package private)  void writeAck(int ackNumber, java.net.SocketAddress addr)
           
protected  void writeHeader()
          Writes the protocol header to this output stream.
(package private)  void writeMessage(java.net.SocketAddress addr, Message msg, long currentTimeMillis)
           
(package private)  void writeMessage(UDPNetwork.ServerInfo serverInfo, java.net.SocketAddress addr, int startIndex, Message msg, long currentTimeMillis)
           
 
Methods inherited from class fr.dyade.aaa.agent.MessageOutputStream
getLogger, write, writeInt, writeMessage, writeMessageHeader, writeShort
 
Methods inherited from class java.io.OutputStream
close, flush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

datagramStamp

private int datagramStamp

size

private int size

serverAddr

private java.net.SocketAddress serverAddr

serverInfo

private UDPNetwork.ServerInfo serverInfo

ackBuf

private byte[] ackBuf

handshakeBuf

private byte[] handshakeBuf
Constructor Detail

UDPNetwork.DatagramOutputStream

UDPNetwork.DatagramOutputStream()
                          throws java.io.IOException
Throws:
java.io.IOException
Method Detail

writeMessage

void writeMessage(java.net.SocketAddress addr,
                  Message msg,
                  long currentTimeMillis)
            throws java.io.IOException
Throws:
java.io.IOException

writeAck

void writeAck(int ackNumber,
              java.net.SocketAddress addr)
        throws java.io.IOException
Throws:
java.io.IOException

write

public void write(int b)
           throws java.io.IOException
Description copied from class: MessageOutputStream
Writes the specified byte to this output stream.

Specified by:
write in class MessageOutputStream
Parameters:
b - the byte to be written.
Throws:
java.io.IOException - if an I/O error occurs.

sendPacket

private void sendPacket()
                 throws java.io.IOException
Throws:
java.io.IOException

writeMessage

void writeMessage(UDPNetwork.ServerInfo serverInfo,
                  java.net.SocketAddress addr,
                  int startIndex,
                  Message msg,
                  long currentTimeMillis)
            throws java.io.IOException
Throws:
java.io.IOException

handShake

void handShake(java.net.SocketAddress addr)
         throws java.io.IOException
Throws:
java.io.IOException

write

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

Specified by:
write in class MessageOutputStream
Parameters:
b - the data.
off - the start offset in the data.
len - the number of bytes to write.
Throws:
java.io.IOException - if an I/O error occurs.

writeHeader

protected void writeHeader()
Description copied from class: MessageOutputStream
Writes the protocol header to this output stream. This method must be overloaded in subclass.

Specified by:
writeHeader in class MessageOutputStream


Copyright © 2010 ScalAgent D.T.. All Rights Reserved.