Class MagnetURI

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

public class MagnetURI extends Object
Since:
0.9.4 moved from I2PSnarkServlet
  • Field Details

  • Constructor Details

  • 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

      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
      Since:
      0.9.67 TODO to be hooked in via SnarkManager.addMagnet() and new Snark()
    • toMagnetLink

      public static String toMagnetLink(byte[] ih, String announce)
      Parameters:
      ih - 20 or 32 bytes
      announce - may be null
      Since:
      0.9.71 moved from I2PSnarkServlet
    • toMagnetLink

      public static String toMagnetLink(byte[] ih, String announce, String basename)
      Parameters:
      ih - 20 or 32 bytes
      announce - may be null
      basename - may be null. NOT URL-escaped.
      Since:
      0.9.71
    • toMagnetLink

      public static String toMagnetLink(byte[] ih, String announce, String basename, long length)
      Parameters:
      ih - 20 or 32 bytes
      announce - may be null
      basename - 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 bytes
      announce - may be null
      basename - may be null. NOT URL-escaped.
      length - 0 if unknown
      ih - 32 bytes or null
      Returns:
      html and URL escaped
      Since:
      0.9.71 moved from I2PSnarkServlet
    • main

      public static void main(String[] args)
      Since:
      0.9.71