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 voidstatic booleancanChangeTorrentEncoding(TOTorrent torrent) static StringgetCurrentTorrentEncoding(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 LocaleUtilDecodergetTorrentEncoding(TOTorrent torrent) Get the torrent's encoding, optionally prompting the user to choose from a list if needed.static LocaleUtilDecodergetTorrentEncoding(TOTorrent torrent, boolean saveToFileAllowed, boolean forcePrompt) static LocaleUtilDecodergetTorrentEncodingIfAvailable(TOTorrent torrent) Retrieves the encoding of the torrent if it can be determined.static voidprivate static voidretainAll(List<LocaleUtilDecoderCandidate> listToModify, List<LocaleUtilDecoderCandidate> list) static voidsetDefaultTorrentEncoding(TOTorrent torrent) static voidsetTorrentEncoding(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
-
canChangeTorrentEncoding
-
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:
LocaleUtilDecoderCandidates 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
-