org.klomp.snark

## Class MagnetURI

- java.lang.Object
- - org.klomp.snark.MagnetURI

-     public class MagnetURI
      extends Object

  Magnet URI parser and handler for BitTorrent magnet links.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `MAGGOT` http://sponge.i2p/files/maggotspec.txt
    `static String` | `MAGNET` BEP 9
    `static String` | `MAGNET_FULL`
    `static String` | `MAGNET_FULL_V2` https://blog.libtorrent.org/2020/09/bittorrent-v2/ TODO, dup param parsing, as a dual v1/v2 link will contain two xt params

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MagnetURI(I2PSnarkUtil util, String url)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `getInfoHash()`
    `String` | `getName()`
    `String` | `getTrackerURL()`
    `List<String>` | `getTrackerURLs()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### MAGGOT

          public static final String MAGGOT

      http://sponge.i2p/files/maggotspec.txt
      See Also:
        Constant Field Values

    - #### MAGNET

          public static final String MAGNET

      BEP 9
      See Also:
        Constant Field Values

    - #### MAGNET_FULL

          public static final String MAGNET_FULL

      See Also:
        Constant Field Values

    - #### MAGNET_FULL_V2

          public static final String MAGNET_FULL_V2

      https://blog.libtorrent.org/2020/09/bittorrent-v2/ TODO, dup param parsing, as a dual v1/v2 link will contain two xt params
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### MagnetURI

          public MagnetURI(I2PSnarkUtil util,
                           String url)
                    throws IllegalArgumentException

      Parameters:
        `url` - non-null
      Throws:
        `IllegalArgumentException`

  - ### Method Detail

    - #### getInfoHash

          public byte[] getInfoHash()

      Returns:
        20 bytes or null

    - #### getName

          public String getName()

      Returns:
        pretty name or null, NOT HTML escaped

    - #### getTrackerURL

          public String getTrackerURL()

      Returns:
        first valid tracker url or null

    - #### getTrackerURLs

          public List<String> getTrackerURLs()

      Returns:
        all valid tracker urls or null if none