Package com.biglybt.core.internat
Class LocaleTorrentUtil
- java.lang.Object
-
- com.biglybt.core.internat.LocaleTorrentUtil
-
public class LocaleTorrentUtil extends java.lang.Object
Locale functions specific to Torrents.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.List<LocaleUtilListener>
listeners
-
Constructor Summary
Constructors Constructor Description LocaleTorrentUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addListener(LocaleUtilListener l)
static java.lang.String
getCurrentTorrentEncoding(TOTorrent torrent)
protected static java.util.List<LocaleUtilDecoderCandidate>
getTorrentCandidates(TOTorrent torrent)
Checks the Torrent's text fields (path, comment, etc) against a list of locals, returning only those that can handle all the fields.static LocaleUtilDecoder
getTorrentEncoding(TOTorrent torrent)
Get the torrent's encoding, optionally prompting the user to choose from a list if needed.static LocaleUtilDecoder
getTorrentEncoding(TOTorrent torrent, boolean saveToFileAllowed, boolean forcePrompt)
static LocaleUtilDecoder
getTorrentEncodingIfAvailable(TOTorrent torrent)
Retrieves the encoding of the torrent if it can be determined.static void
removeListener(LocaleUtilListener l)
private static void
retainAll(java.util.List<LocaleUtilDecoderCandidate> listToModify, java.util.List<LocaleUtilDecoderCandidate> list)
static void
setDefaultTorrentEncoding(TOTorrent torrent)
static void
setTorrentEncoding(TOTorrent torrent, java.lang.String encoding)
-
-
-
Field Detail
-
listeners
private static final java.util.List<LocaleUtilListener> listeners
-
-
Method Detail
-
getTorrentEncodingIfAvailable
public static LocaleUtilDecoder getTorrentEncodingIfAvailable(TOTorrent torrent)
Retrieves the encoding of the torrent if it can be determined.
Does not prompt the user with choices.- Parameters:
torrent
- Torrent to get encoding of- Returns:
- Locale torrent is in. Torrents with .utf8 keys will always get a decoder
-
getTorrentEncoding
public static LocaleUtilDecoder getTorrentEncoding(TOTorrent torrent) throws TOTorrentException
Get the torrent's encoding, optionally prompting the user to choose from a list if needed.- Parameters:
torrent
- Torrent to get encoding of- Returns:
- LocaleUtilDecoder that the torrent is in
- Throws:
TOTorrentException
-
getTorrentEncoding
public static LocaleUtilDecoder getTorrentEncoding(TOTorrent torrent, boolean saveToFileAllowed, boolean forcePrompt) throws TOTorrentException
- Throws:
TOTorrentException
-
getTorrentCandidates
protected static java.util.List<LocaleUtilDecoderCandidate> getTorrentCandidates(TOTorrent torrent)
Checks the Torrent's text fields (path, comment, etc) against a list of locals, returning only those that can handle all the fields.- Returns:
LocaleUtilDecoderCandidate
s that can decode the torrent. All entries will have a non-null decoder
-
retainAll
private static void retainAll(java.util.List<LocaleUtilDecoderCandidate> listToModify, java.util.List<LocaleUtilDecoderCandidate> list)
-
setTorrentEncoding
public static void setTorrentEncoding(TOTorrent torrent, java.lang.String encoding) throws LocaleUtilEncodingException
- Throws:
LocaleUtilEncodingException
-
setDefaultTorrentEncoding
public static void setDefaultTorrentEncoding(TOTorrent torrent) throws LocaleUtilEncodingException
- Throws:
LocaleUtilEncodingException
-
getCurrentTorrentEncoding
public static java.lang.String getCurrentTorrentEncoding(TOTorrent torrent)
-
addListener
public static void addListener(LocaleUtilListener l)
-
removeListener
public static void removeListener(LocaleUtilListener l)
-
-