Package com.biglybt.core.internat
Class LocaleTorrentUtil
java.lang.Object
com.biglybt.core.internat.LocaleTorrentUtil
Locale functions specific to Torrents.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
static String
getCurrentTorrentEncoding
(TOTorrent torrent) protected static 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
private static void
retainAll
(List<LocaleUtilDecoderCandidate> listToModify, List<LocaleUtilDecoderCandidate> list) static void
setDefaultTorrentEncoding
(TOTorrent torrent) static void
setTorrentEncoding
(TOTorrent torrent, String encoding)
-
Field Details
-
listeners
-
-
Constructor Details
-
LocaleTorrentUtil
public LocaleTorrentUtil()
-
-
Method Details
-
getTorrentEncodingIfAvailable
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
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
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(List<LocaleUtilDecoderCandidate> listToModify, List<LocaleUtilDecoderCandidate> list) -
setTorrentEncoding
public static void setTorrentEncoding(TOTorrent torrent, String encoding) throws LocaleUtilEncodingException - Throws:
LocaleUtilEncodingException
-
setDefaultTorrentEncoding
- Throws:
LocaleUtilEncodingException
-
getCurrentTorrentEncoding
-
addListener
-
removeListener
-