|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.limegroup.gnutella.URN
This class represents an individual Uniform Resource Name (URN), as specified in RFC 2141. This does extensive validation of URNs to make sure that they are valid, with the factory methods throwing excpeptions when the arguments do not meet URN syntax. This does not perform rigorous verification of the SHA1 values themselves. This class is immutable.
UrnCache
,
FileDesc
,
UrnType
,
Serializable
,
Serialized FormField Summary | |
static URN |
INVALID
A constant invalid URN that classes can use to represent an invalid URN. |
Method Summary | |
static URN |
createSHA1Urn(java.io.File file)
Creates a new URN instance with a SHA1 hash. |
static URN |
createSHA1Urn(java.lang.String urnString)
Creates a new URN instance from the specified string. |
static URN |
createSHA1UrnFromHttpRequest(java.lang.String requestLine)
Creates a URN instance from the specified HTTP request line. |
static URN |
createSHA1UrnFromUriRes(java.lang.String sha1String)
Convenience method for creating a URN instance from a string in the form: |
static URN |
createSHA1UrnFromURL(java.net.URL url)
Convenience method for creating a SHA1 URN from a URL. |
boolean |
equals(java.lang.Object o)
Checks for URN equality. |
static int |
getHashingProgress(java.io.File file)
Gets the amount of bytes hashed for a file that is being hashed. |
UrnType |
getUrnType()
Returns the UrnType instance for this URN. |
int |
hashCode()
Overrides the hashCode method of Object to meet the contract of hashCode. |
java.lang.String |
httpStringValue()
Returns a string representation of the HTTP header value for this class. |
boolean |
isSHA1()
Returns whether or not this URN is a SHA1 URN. |
static boolean |
isUrn(java.lang.String urnString)
Returns whether or not the URN_STRING argument is a valid URN string, as specified in RFC 2141. |
java.lang.String |
toString()
Overrides toString to return the URN string. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final URN INVALID
Method Detail |
public static int getHashingProgress(java.io.File file)
public static URN createSHA1Urn(java.io.File file) throws java.io.IOException, java.lang.InterruptedException
file
- the File instance to use to create a
URN
IOException
- if there was an error constructing
the URN
InterruptedException
- if the calling thread was
interrupted while hashing. (This method can take a while to
execute.)
java.io.IOException
java.lang.InterruptedException
public static URN createSHA1Urn(java.lang.String urnString) throws java.io.IOException
urnString
- a string description of the URN. Typically
this will be a SHA1 containing a 32-character value, e.g.,
"urn:sha1:GLSTHIPQGSSZTS5FJUPAKPZWUGYQYPFB".
IOException
- urnString was malformed or an
unsupported type
java.io.IOException
public static URN createSHA1UrnFromURL(java.net.URL url) throws java.io.IOException
/uri-res/N2R?urn:sha1:SHA1URNHERE
url
- the URL to extract the URN from
IOException
- if there is an error reading the URN from
the URL
java.io.IOException
public static URN createSHA1UrnFromUriRes(java.lang.String sha1String) throws java.io.IOException
/uri-res/N2R?urn:sha1:PLSTHIPQGSSZTS5FJUPAKUZWUGYQYPFB
java.io.IOException
public static URN createSHA1UrnFromHttpRequest(java.lang.String requestLine) throws java.io.IOException
requestLine
- the URN HTTP request of the form specified in
RFC 2169, for example:/uri-res/N2R?urn:sha1:PLSTHIPQGSSZTS5FJUPAKUZWUGYQYPFB HTTP/1.1
java.io.IOException
Acceptor
public UrnType getUrnType()
public java.lang.String httpStringValue()
HTTPHeaderValue
httpStringValue
in interface HTTPHeaderValue
public static boolean isUrn(java.lang.String urnString)
urnString
- the urn string to check for validity
public boolean isSHA1()
public boolean equals(java.lang.Object o)
o
- the object to compare against
public int hashCode()
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |