X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Frhynodge%2Fstates%2FTorrentState.java;h=22da77f8599d4301c4b73016dec98b12c01051fd;hb=dc182c1007455256e7a064ff9b0bedfd9a7a7a74;hp=ce5b06f78a6da752cc378cafcbec1e058c6f38d8;hpb=6f69aff66ba5617d0bb27874014b4274bc551ab8;p=rhynodge.git diff --git a/src/main/java/net/pterodactylus/rhynodge/states/TorrentState.java b/src/main/java/net/pterodactylus/rhynodge/states/TorrentState.java index ce5b06f..22da77f 100644 --- a/src/main/java/net/pterodactylus/rhynodge/states/TorrentState.java +++ b/src/main/java/net/pterodactylus/rhynodge/states/TorrentState.java @@ -18,6 +18,8 @@ package net.pterodactylus.rhynodge.states; import java.nio.charset.Charset; +import java.util.Collection; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -47,6 +49,15 @@ public class TorrentState extends AbstractState implements Iterable // /** + * Returns all torrent files of this state. + * + * @return All torrent files of this state + */ + public Collection torrentFiles() { + return Collections.unmodifiableList(files); + } + + /** * Adds a torrent file to this state. * * @param torrentFile @@ -179,7 +190,8 @@ public class TorrentState extends AbstractState implements Iterable /** * Returns the magnet URI of the file. * - * @return The magnet URI of the file + * @return The magnet URI of the file, or {@code null} if there is no + * magnet URI for this torrent file */ public String magnetUri() { return magnetUri; @@ -188,7 +200,8 @@ public class TorrentState extends AbstractState implements Iterable /** * Returns the download URI of the file. * - * @return The download URI of the file + * @return The download URI of the file, or {@code null} if there is no + * download URI for this torrent file */ public String downloadUri() { return downloadUri; @@ -260,7 +273,7 @@ public class TorrentState extends AbstractState implements Iterable List parameters = URLEncodedUtils.parse(magnetUri.substring("magnet:?".length()), Charset.forName("UTF-8")); for (NameValuePair parameter : parameters) { if (parameter.getName().equals("xt")) { - return parameter.getValue(); + return parameter.getValue().toLowerCase(); } } return null;