com.limegroup.gnutella.bootstrap
Class BootstrapServer

java.lang.Object
  extended by com.limegroup.gnutella.bootstrap.BootstrapServer
All Implemented Interfaces:
java.io.Serializable

public class BootstrapServer
extends java.lang.Object
implements java.io.Serializable

A URL for a GWebCache endpoint, plus some additional connection history data:

Written to and read from gnutella.net.

See Also:
GWebCache, HostCatcher, Serialized Form

Constructor Summary
BootstrapServer()
           
BootstrapServer(java.lang.String s)
          Constructs a new BootstrapServer from a URL or an extended gnutella.net data line.
 
Method Summary
 boolean equals(java.lang.Object o)
          Returns true if o is a BootStrapServer with the same URL.
 java.lang.String get_url()
           
 java.lang.String getURLString()
          Returns the URL to the server, minus any request parameters.
 int hashCode()
          Creates an integer suitable for hash table indexing.
 void set_url(java.lang.String url)
           
static boolean startsWithIgnoreCase(java.lang.String s, java.lang.String prefix)
          Returns true iff s starts with prefix, ignoring case.
 java.lang.String toString()
          Returns a parsable represenation of this.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BootstrapServer

public BootstrapServer()

BootstrapServer

public BootstrapServer(java.lang.String s)
                throws java.text.ParseException
Constructs a new BootstrapServer from a URL or an extended gnutella.net data line.

Parameters:
s - single line of the form "http://server.com/path/to/script" or or "http://server.com/path/to/script,dtime,ctimes,ftimes". In the extended format, "dtime" is the host discovery time, ctimes is a semicolon separated list of successful connect times, and ftimes is semicolon separated list of unsuccessful connect times.
Throws:
java.text.ParseException - line could not be be parsed in either format. The offset is not necessarily set.
Method Detail

getURLString

public java.lang.String getURLString()
Returns the URL to the server, minus any request parameters. This is guaranteed to be non-null.


set_url

public void set_url(java.lang.String url)

get_url

public java.lang.String get_url()

toString

public java.lang.String toString()
Returns a parsable represenation of this. This can be reconstructed by constructing a new BootstrapServer with the returned string as an argument. Does not include any end-of-line characters.

Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Creates an integer suitable for hash table indexing.

The hash code is based upon all the URL components relevant for URL comparison. As such, this operation is a blocking operation.

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Returns true if o is a BootStrapServer with the same URL.

Overrides:
equals in class java.lang.Object

startsWithIgnoreCase

public static boolean startsWithIgnoreCase(java.lang.String s,
                                           java.lang.String prefix)
Returns true iff s starts with prefix, ignoring case.

Returns:
true iff s.toUpperCase().startsWith(prefix.toUpperCase())