keepalive.communication
Class Output
java.lang.Object
|
+--keepalive.communication.Output
- All Implemented Interfaces:
- Sender
- public class Output
- extends java.lang.Object
- implements Sender
Send an outgoing stream of characters.
Constructor Summary |
Output(AbstractSocket sock,
java.lang.String participantName)
Create a new Output object |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Output
public Output(AbstractSocket sock,
java.lang.String participantName)
- Create a new Output object
- Parameters:
sock
- Socket through which we send the outgoing stream.participantName
- The name of the "user" of this class; for
debugging purposes.
sendMessage
public void sendMessage()
throws java.io.IOException
- Send a message with a serial number.
- Throws:
java.io.IOException
- if if an I/O error occurs.
send
public void send(java.lang.String sendThis)
throws java.io.IOException
- Send a message with the given String. From Sender interface.
- Specified by:
send
in interface Sender
- Parameters:
sendThis
- message to be sent.- Throws:
java.io.IOException
- if an I/O error occurs.
close
public void close()
- Close socket. From Sender interface
- Specified by:
close
in interface Sender
lastTimeStamp
public long lastTimeStamp()
- Get time that last message was sent. From Sender interface.
- Specified by:
lastTimeStamp
in interface Sender
- Following copied from interface:
keepalive.communication.Sender
- Returns:
- when data was last sent, in milliseconds since the epoch. If
data has not yet been sent, return the time of instantiation of this
Object.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
setMessageDisplayer
public void setMessageDisplayer(MessageDisplayer ui)
- Set the object that will display all outgoing messages as
they are sent.
- Parameters:
ui
- User interface which will display messages.