com.skype
Class Stream

java.lang.Object
  extended by com.skype.Stream
All Implemented Interfaces:
Serializable

public final class Stream
extends Object

This class implements a simple way of sending and receiving AP2AP data.

See Also:
Serialized Form

Method Summary
 void addStreamListener(StreamListener listener)
          Add a listener to this AP2AP Stream.
 void disconnect()
          Disconenct this Stream and close the AP2AP connection.
 boolean equals(Object compared)
          Overridden to compare Stream objects based on ID.
 Application getApplication()
          Return the application this stream belongs to.
 Object getData(String name)
          Returns the user data to which this object maps to the specified by the name.
 Friend getFriend()
          Return the User which is on the other end of this Stream.
 String getId()
          Return ID of this Stream.
 int hashCode()
          Overridden to use ID as hashcode.
 void removeStreamListener(StreamListener listener)
          Remove a listener from the collection of listeners to this Stream.
 void send(String datagram)
          Send a datagram message through this stream.
 void setData(String name, Object userData)
          Associates the specified user data with the specified name in this object.
 String toString()
          Return ID as String representation.
 void write(String text)
          Send a message through this Stream.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

hashCode

public int hashCode()
Overridden to use ID as hashcode.

Overrides:
hashCode in class Object
Returns:
ID.

equals

public boolean equals(Object compared)
Overridden to compare Stream objects based on ID.

Overrides:
equals in class Object
Parameters:
compared - the object to compare to.
Returns:
true if ID's are equal.

toString

public String toString()
Return ID as String representation.

Overrides:
toString in class Object
Returns:
ID.

getApplication

public Application getApplication()
Return the application this stream belongs to.

Returns:
the AP2AP application.

getId

public String getId()
Return ID of this Stream.

Returns:
ID.

getFriend

public Friend getFriend()
Return the User which is on the other end of this Stream.

Returns:
User.

write

public void write(String text)
           throws SkypeException
Send a message through this Stream.

Parameters:
text - The message to send.
Throws:
SkypeException - when the connection to the Skype client has gone bad or AP2AP connection is not ok.

send

public void send(String datagram)
          throws SkypeException
Send a datagram message through this stream.

Parameters:
datagram - the data message to send.
Throws:
SkypeException - when the Skype client connection has gone bad or when AP2AP connection is not ok.

addStreamListener

public void addStreamListener(StreamListener listener)
Add a listener to this AP2AP Stream.

Parameters:
listener - listener to add to the collection of listeners.

removeStreamListener

public void removeStreamListener(StreamListener listener)
Remove a listener from the collection of listeners to this Stream.

Parameters:
listener - the listener to remove.

disconnect

public void disconnect()
                throws SkypeException
Disconenct this Stream and close the AP2AP connection.

Throws:
SkypeException - when the Skype client connection has gone bad.

getData

public final Object getData(String name)
Returns the user data to which this object maps to the specified by the name. Returns null if this object contains no mapping for the name.

Parameters:
name - name whose associated user data is to be returned.
Returns:
the user data to which this object maps the specified name, or null if this object contains no mapping for the name.
See Also:
Map.get(Object)

setData

public final void setData(String name,
                          Object userData)
Associates the specified user data with the specified name in this object.

Parameters:
name - name with which the specified user data is to be associated.
userData - user data to be associated with the specified name.
See Also:
Map.put(Object, Object)


Copyright © 2004-2011. All Rights Reserved.