public class LanguageProfileReader
extends java.lang.Object
LanguageProfiles.| Modifier and Type | Field and Description |
|---|---|
private static LangProfileReader |
internalReader |
private static java.lang.String |
PROFILES_DIR |
| Constructor and Description |
|---|
LanguageProfileReader() |
| Modifier and Type | Method and Description |
|---|---|
private boolean |
looksLikeLanguageProfileFile(java.io.File file) |
private boolean |
looksLikeLanguageProfileName(java.lang.String fileName) |
private java.lang.String |
makePathForClassLoader(java.lang.String profileDirectory,
java.lang.String fileName) |
private @NotNull java.lang.String |
makeProfileFileName(@NotNull LdLocale locale) |
java.util.List<LanguageProfile> |
read(java.lang.ClassLoader classLoader,
java.lang.String profileDirectory,
java.util.Collection<java.lang.String> profileFileNames)
Load profiles from the classpath in a specific directory.
|
java.util.List<LanguageProfile> |
read(java.util.Collection<java.lang.String> profileFileNames)
Same as
read(ClassLoader, String, java.util.Collection) using the class loader of this class,
and the default profiles directory of this library. |
LanguageProfile |
read(java.io.File profileFile)
Reads a
LanguageProfile from a File in UTF-8. |
LanguageProfile |
read(java.io.InputStream inputStream)
Reads a
LanguageProfile from an InputStream in UTF-8. |
java.util.List<LanguageProfile> |
read(java.lang.String profileDirectory,
java.util.Collection<java.lang.String> profileFileNames)
Same as
read(ClassLoader, String, java.util.Collection) using the class loader of this class. |
java.util.List<LanguageProfile> |
readAll()
Deprecated.
renamed to readAllBuiltIn()
|
java.util.List<LanguageProfile> |
readAll(java.io.File path)
Loads all profiles from the specified directory.
|
java.util.List<LanguageProfile> |
readAllBuiltIn()
Reads all built-in language profiles from the "languages" folder (shipped with the jar).
|
@NotNull java.util.List<LanguageProfile> |
readBuiltIn(@NotNull java.util.Collection<LdLocale> languages) |
@NotNull LanguageProfile |
readBuiltIn(@NotNull LdLocale locale) |
private static final LangProfileReader internalReader
private static final java.lang.String PROFILES_DIR
public LanguageProfile read(java.io.File profileFile) throws java.io.IOException
LanguageProfile from a File in UTF-8.java.io.IOExceptionpublic LanguageProfile read(java.io.InputStream inputStream) throws java.io.IOException
LanguageProfile from an InputStream in UTF-8.java.io.IOExceptionpublic java.util.List<LanguageProfile> read(java.lang.ClassLoader classLoader, java.lang.String profileDirectory, java.util.Collection<java.lang.String> profileFileNames) throws java.io.IOException
This is usually used to load built-in profiles, shipped with the jar.
classLoader - the ClassLoader to load the profiles from. Use MyClass.class.getClassLoader()profileDirectory - profile directory path inside the classpath. The default profiles are in "languages".profileFileNames - for example ["en", "fr", "de"].java.io.IOExceptionprivate java.lang.String makePathForClassLoader(java.lang.String profileDirectory,
java.lang.String fileName)
public java.util.List<LanguageProfile> read(java.lang.String profileDirectory, java.util.Collection<java.lang.String> profileFileNames) throws java.io.IOException
read(ClassLoader, String, java.util.Collection) using the class loader of this class.java.io.IOExceptionpublic java.util.List<LanguageProfile> read(java.util.Collection<java.lang.String> profileFileNames) throws java.io.IOException
read(ClassLoader, String, java.util.Collection) using the class loader of this class,
and the default profiles directory of this library.java.io.IOException@NotNull public @NotNull LanguageProfile readBuiltIn(@NotNull @NotNull LdLocale locale) throws java.io.IOException
java.io.IOException@NotNull
private @NotNull java.lang.String makeProfileFileName(@NotNull
@NotNull LdLocale locale)
@NotNull public @NotNull java.util.List<LanguageProfile> readBuiltIn(@NotNull @NotNull java.util.Collection<LdLocale> languages) throws java.io.IOException
java.io.IOExceptionpublic java.util.List<LanguageProfile> readAll() throws java.io.IOException
java.io.IOExceptionpublic java.util.List<LanguageProfile> readAllBuiltIn() throws java.io.IOException
java.io.IOExceptionpublic java.util.List<LanguageProfile> readAll(java.io.File path) throws java.io.IOException
path - profile directory pathjava.io.IOExceptionprivate boolean looksLikeLanguageProfileFile(java.io.File file)
private boolean looksLikeLanguageProfileName(java.lang.String fileName)