192021222324252627
* Detect language from a String * @param text * @return detected language */ public static String detectLanguage(String text) { LanguageIdentifier li = getLIInstance(); return li.identify(text); }
3132333435363738
* @param is * @return detected language * @throws IOException */ public static String detectLanguage(InputStream is) throws IOException { LanguageIdentifier li = getLIInstance(); return li.identify(is); }
4344454647484950
* @param charset * @return detected language * @throws IOException */ public static String detectLanguage(InputStream is, String charset) throws IOException { LanguageIdentifier li = getLIInstance(); return li.identify(is, charset); }
495051525354555657
return li.identify(is, charset); } private static LanguageIdentifier getLIInstance() { if (langID == null) { langID = new LanguageIdentifier(); } return (langID); }