|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.echomine.net.ConnectionModel
public class ConnectionModel
Contains all the data that are needed by Connector to make a connection. Subclasses can store additional details such as protocol version (ie. HTTP 1.1). This connection model also adds support for throttling and bandwidth management. Not all uses of this model will make use of such feature, but the feature is there is a need for it.
Constructor Summary | |
---|---|
ConnectionModel(java.net.InetAddress host,
int port)
|
|
ConnectionModel(java.net.InetAddress host,
int port,
ConnectionThrottler throttler)
|
|
ConnectionModel(int port)
Normally used to create a listener for incoming connections. |
|
ConnectionModel(java.lang.String hostname,
int port)
|
|
ConnectionModel(java.lang.String hostname,
int port,
ConnectionThrottler throttler)
|
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
|
java.net.InetAddress |
getHost()
|
java.lang.String |
getHostAddress()
Convenience Method for obtaining the host IP from the InetAddress |
java.lang.String |
getHostName()
Convenience Method for obtaining the hostname from the InetAddress |
int |
getPort()
|
ConnectionThrottler |
getThrottler()
|
long |
getTimeOnlineMillis()
|
java.lang.String |
getTimeOnlineString()
|
long |
getTransferBPS()
|
float |
getTransferKBPS()
|
void |
incrementBytesTransferred(long increment)
increments the bytes transferred for calculation of throttling as well as the bandwidth BPS |
boolean |
isSSL()
replies whether this is secure or not |
void |
reset()
Resets all the data fields back to the initial state. |
void |
setEndTime(long endTime)
Sets the end time when the transfer is finished |
void |
setHost(java.net.InetAddress host)
sets the host after the connection created |
void |
setPort(int port)
sets the port after the connection is created |
void |
setSSL(boolean secure)
sets this to be a secure SSL connection |
void |
setStartTime(long startTime)
Sets the start time when the connection begins. |
void |
setThrottler(ConnectionThrottler throttler)
sets the throttler for the connection bandwidth. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ConnectionModel(int port)
port
- the port to connect to/receive frompublic ConnectionModel(java.net.InetAddress host, int port)
host
- the InetAddress containing the hostname/IPport
- the port to connect to/receive frompublic ConnectionModel(java.lang.String hostname, int port) throws java.net.UnknownHostException
hostname
- the hostname/IP to createport
- the port to connect to/receive from
java.net.UnknownHostException
public ConnectionModel(java.net.InetAddress host, int port, ConnectionThrottler throttler)
host
- the InetAddress containing the hostname/IPport
- the port to connect to/receive fromthrottler
- the bandwidth throttler, or null if no throttlingpublic ConnectionModel(java.lang.String hostname, int port, ConnectionThrottler throttler) throws java.net.UnknownHostException
hostname
- the hostname/IP to createport
- the port to connect to/receive fromthrottler
- the bandwidth throttler, or null if no throttling
java.net.UnknownHostException
Method Detail |
---|
public int getPort()
public java.net.InetAddress getHost()
public java.lang.String getHostName()
public java.lang.String getHostAddress()
public void setPort(int port)
public void setHost(java.net.InetAddress host)
public void setSSL(boolean secure)
public boolean isSSL()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public void setThrottler(ConnectionThrottler throttler)
public ConnectionThrottler getThrottler()
public java.lang.String toString()
toString
in class java.lang.Object
public void incrementBytesTransferred(long increment)
public float getTransferKBPS()
public long getTransferBPS()
public long getTimeOnlineMillis()
public java.lang.String getTimeOnlineString()
public void reset()
public void setStartTime(long startTime)
public void setEndTime(long endTime)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |