Package org.klomp.snark
Class MagnetURI
java.lang.Object
org.klomp.snark.MagnetURI
- Since:
- 0.9.4 moved from I2PSnarkServlet
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]byte[]Returns the SHA-256 hash, or null if not v2.longgetName()static voidstatic StringtoMagnetLink(byte[] ih, byte[] ih2, String announce, String basename, long length) static StringtoMagnetLink(byte[] ih, String announce) static StringtoMagnetLink(byte[] ih, String announce, String basename) static StringtoMagnetLink(byte[] ih, String announce, String basename, long length)
-
Field Details
-
MAGNET
BEP 9- See Also:
-
MAGNET_FULL
- See Also:
-
MAGGOT
http://sponge.i2p/files/maggotspec.txt- See Also:
-
MAGNET_FULL_V2
- See Also:
-
-
Constructor Details
-
MagnetURI
- Parameters:
util- null for unit testsurl- non-null- Throws:
IllegalArgumentException
-
-
Method Details
-
getInfoHash
public byte[] getInfoHash()- Returns:
- 20 bytes or null if not v1.
-
getInfoHashV2
public byte[] getInfoHashV2()Returns the SHA-256 hash, or null if not v2.- Since:
- 0.9.71
-
getLength
public long getLength()- Returns:
- the length or 0 if not specified.
- Since:
- 0.9.71
-
getName
- Returns:
- pretty name or null, NOT HTML escaped
-
getTrackerURL
- Returns:
- first valid tracker url or null
-
getTrackerURLs
- Returns:
- all valid tracker urls or null if none
- Since:
- 0.9.67 TODO to be hooked in via SnarkManager.addMagnet() and new Snark()
-
toMagnetLink
- Parameters:
ih- 20 or 32 bytesannounce- may be null- Since:
- 0.9.71 moved from I2PSnarkServlet
-
toMagnetLink
- Parameters:
ih- 20 or 32 bytesannounce- may be nullbasename- may be null. NOT URL-escaped.- Since:
- 0.9.71
-
toMagnetLink
- Parameters:
ih- 20 or 32 bytesannounce- may be nullbasename- may be null. NOT URL-escaped.length- 0 if unknown- Since:
- 0.9.71
-
toMagnetLink
public static String toMagnetLink(byte[] ih, byte[] ih2, String announce, String basename, long length) - Parameters:
ih- 20 or 32 bytesannounce- may be nullbasename- may be null. NOT URL-escaped.length- 0 if unknownih- 32 bytes or null- Returns:
- html and URL escaped
- Since:
- 0.9.71 moved from I2PSnarkServlet
-
main
- Since:
- 0.9.71
-