Package fr.dyade.aaa.agent
Class UDPNetwork.DatagramOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- fr.dyade.aaa.agent.MessageOutputStream
-
- fr.dyade.aaa.agent.UDPNetwork.DatagramOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
- Enclosing class:
- UDPNetwork
final class UDPNetwork.DatagramOutputStream extends MessageOutputStream
Class used to send messages with UDP packets.
-
-
Field Summary
Fields Modifier and Type Field Description private byte[]ackBufprivate intdatagramStampprivate byte[]handshakeBufprivate SocketAddressserverAddrprivate UDPNetwork.ServerInfoserverInfoprivate intsize-
Fields inherited from class fr.dyade.aaa.agent.MessageOutputStream
buf, compressedFlows, count, oos
-
-
Constructor Summary
Constructors Constructor Description DatagramOutputStream()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidhandShake(SocketAddress addr)private voidsendPacket()voidwrite(byte[] b, int off, int len)Writeslenbytes from the specified byte array starting at offsetoffto this output stream.voidwrite(int b)Writes the specified byte to this output stream.(package private) voidwriteAck(int ackNumber, SocketAddress addr)protected voidwriteHeader()Writes the protocol header to this output stream.(package private) voidwriteMessage(UDPNetwork.ServerInfo serverInfo, SocketAddress addr, int startIndex, Message msg, long currentTimeMillis)(package private) voidwriteMessage(SocketAddress addr, Message msg, long currentTimeMillis)-
Methods inherited from class fr.dyade.aaa.agent.MessageOutputStream
write, writeInt, writeMessage, writeMessageHeader, writeShort
-
Methods inherited from class java.io.OutputStream
close, flush, nullOutputStream
-
-
-
-
Field Detail
-
datagramStamp
private int datagramStamp
-
size
private int size
-
serverAddr
private SocketAddress serverAddr
-
serverInfo
private UDPNetwork.ServerInfo serverInfo
-
ackBuf
private byte[] ackBuf
-
handshakeBuf
private byte[] handshakeBuf
-
-
Constructor Detail
-
DatagramOutputStream
DatagramOutputStream() throws IOException- Throws:
IOException
-
-
Method Detail
-
writeMessage
void writeMessage(SocketAddress addr, Message msg, long currentTimeMillis) throws IOException
- Throws:
IOException
-
writeAck
void writeAck(int ackNumber, SocketAddress addr) throws IOException- Throws:
IOException
-
write
public void write(int b) throws IOExceptionDescription copied from class:MessageOutputStreamWrites the specified byte to this output stream.- Specified by:
writein classMessageOutputStream- Parameters:
b- the byte to be written.- Throws:
IOException- if an I/O error occurs.
-
sendPacket
private void sendPacket() throws IOException- Throws:
IOException
-
writeMessage
void writeMessage(UDPNetwork.ServerInfo serverInfo, SocketAddress addr, int startIndex, Message msg, long currentTimeMillis) throws IOException
- Throws:
IOException
-
handShake
void handShake(SocketAddress addr) throws IOException
- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOExceptionDescription copied from class:MessageOutputStreamWriteslenbytes from the specified byte array starting at offsetoffto this output stream.- Specified by:
writein classMessageOutputStream- Parameters:
b- the data.off- the start offset in the data.len- the number of bytes to write.- Throws:
IOException- if an I/O error occurs.
-
writeHeader
protected void writeHeader()
Description copied from class:MessageOutputStreamWrites the protocol header to this output stream. This method must be overloaded in subclass.- Specified by:
writeHeaderin classMessageOutputStream
-
-