Class LocalizedStringLoader
Map-returning load methods return unmodifiable maps containing unmodifiable sets. Their locales iterate in ascending
Locale.toLanguageTag() order. Key lookup and map equality retain ordinary Locale.equals(Object)
semantics. All parse(...) methods return unmodifiable sets.
A generated placeholder may be language-form-driven (LocalizedString.LanguageFormTranslation; localized strings file
members value or range, plus translations) or template-driven
(LocalizedString.ExpressionTranslation; a required default translation, plus optional ordered
expression alternatives). Template alternatives select string fragments only; the first matching
expression wins and the required default is used when none match. Placeholder modes are mutually exclusive, and
all expressions and fragment placeholder references are validated while loading.
Unicode letter, number, and mark membership in placeholder and expression identifiers follows the executing JDK's
Pattern Unicode tables. Author files for the oldest JDK in the deployment fleet when the same files must be
portable across runtime versions; [A-Za-z_][A-Za-z0-9_-]* is the portable ASCII subset.
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionloadFromClasspath(@NonNull ClassLoader classLoader, @NonNull String classpathPackage) Loads all localized strings files present in the specified package using the specified classloader.loadFromClasspath(@NonNull ClassLoader classLoader, @NonNull String classpathPackage, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads localized strings files using the specified classloader and loading/discovery options.loadFromClasspath(@NonNull ClassLoader classLoader, @NonNull String classpathPackage, @NonNull LocalizedStringWarningHandler warningHandler) Loads all localized strings files present in the specified package using the specified classloader, routing validation warnings to the given handler.loadFromClasspath(@NonNull ClassLoader classLoader, @NonNull String classpathPackage, @NonNull LocalizedStringWarningHandler warningHandler, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads localized strings files using the specified classloader, validation-warning policy, and loading/discovery options.loadFromClasspath(@NonNull String classpathPackage) Loads all localized strings files present in the specified package on the classpath.loadFromClasspath(@NonNull String classpathPackage, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads localized strings files from a classpath package using the specified loading and discovery options.loadFromClasspath(@NonNull String classpathPackage, @NonNull LocalizedStringWarningHandler warningHandler) Loads all localized strings files present in the specified package, routing validation warnings to the given handler.loadFromClasspath(@NonNull String classpathPackage, @NonNull LocalizedStringWarningHandler warningHandler, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads localized strings files from a classpath package with validation-warning, loading, and discovery policies.loadFromClasspathResources(@NonNull ClassLoader classLoader, @NonNull Map<@NonNull Locale, @NonNull String> resourcePathByLocale) Loads explicitly mapped classpath resources usingClassLoader.getResourceAsStream(String).loadFromClasspathResources(@NonNull ClassLoader classLoader, @NonNull Map<@NonNull Locale, @NonNull String> resourcePathByLocale, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads explicitly mapped classpath resources with loading limits.loadFromClasspathResources(@NonNull ClassLoader classLoader, @NonNull Map<@NonNull Locale, @NonNull String> resourcePathByLocale, @NonNull LocalizedStringWarningHandler warningHandler) Loads explicitly mapped classpath resources with a validation-warning policy.loadFromClasspathResources(@NonNull ClassLoader classLoader, @NonNull Map<@NonNull Locale, @NonNull String> resourcePathByLocale, @NonNull LocalizedStringWarningHandler warningHandler, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads explicitly mapped classpath resources with validation-warning and aggregate loading-limit policies.Loads explicitly mapped resources from the current thread context classloader usingClassLoader.getResourceAsStream(String).loadFromClasspathResources(@NonNull Map<@NonNull Locale, @NonNull String> resourcePathByLocale, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads explicitly mapped resources from the current thread context classloader with loading limits.loadFromClasspathResources(@NonNull Map<@NonNull Locale, @NonNull String> resourcePathByLocale, @NonNull LocalizedStringWarningHandler warningHandler) Loads explicitly mapped resources from the current thread context classloader with a validation-warning policy.loadFromClasspathResources(@NonNull Map<@NonNull Locale, @NonNull String> resourcePathByLocale, @NonNull LocalizedStringWarningHandler warningHandler, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads explicitly mapped resources from the current thread context classloader with warning and loading policies.loadFromFilesystem(@NonNull Path directory) Loads all localized strings files present in the specified directory.loadFromFilesystem(@NonNull Path directory, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads localized strings files from a directory using the specified resource limits.loadFromFilesystem(@NonNull Path directory, @NonNull LocalizedStringWarningHandler warningHandler) Loads all localized strings files present in the specified directory, routing validation warnings to the given handler.loadFromFilesystem(@NonNull Path directory, @NonNull LocalizedStringWarningHandler warningHandler, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads localized strings files from a directory with validation-warning and resource-limit policies.static @NonNull Set<@NonNull LocalizedString> Parses one UTF-8 localized strings resource for the given locale.static @NonNull Set<@NonNull LocalizedString> parse(@NonNull InputStream inputStream, @NonNull Locale locale, @NonNull String source, @NonNull LocalizedStringWarningHandler warningHandler, @NonNull LocalizedStringLoadingOptions loadingOptions) Parses one UTF-8 localized strings resource with validation-warning and resource-limit policies.static @NonNull Set<@NonNull LocalizedString> Parses one localized strings character resource for the given locale.static @NonNull Set<@NonNull LocalizedString> parse(@NonNull Reader reader, @NonNull Locale locale, @NonNull String source, @NonNull LocalizedStringWarningHandler warningHandler, @NonNull LocalizedStringLoadingOptions loadingOptions) Parses one localized strings character resource with validation-warning and resource-limit policies.static @NonNull Set<@NonNull LocalizedString> Parses one localized strings file for the given locale.static @NonNull Set<@NonNull LocalizedString> parse(@NonNull Path path, @NonNull Locale locale, @NonNull LocalizedStringWarningHandler warningHandler, @NonNull LocalizedStringLoadingOptions loadingOptions) Parses one localized strings file with validation-warning and resource-limit policies.
-
Method Details
-
loadFromClasspath
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromClasspath(@NonNull String classpathPackage) Loads all localized strings files present in the specified package on the classpath.Filenames must correspond to the IETF BCP 47 language tag format, optionally suffixed with
.json.Example filenames:
enen.jsones-MXes-MX.jsonnan-Hant-TW
Like any classpath reference, packages are separated using the
/character.Example package names:
stringscom/example/myapp/strings(recommended to avoid collisions with dependencies)
Note: this implementation only scans the specified package, it does not descend into child packages. A trailing slash is optional and is normalized before lookup.
The physical multi-release JAR namespace
META-INF/versionsand its child packages are reserved and cannot be used for package discovery. UseloadFromClasspathResources(Map)when an exact resource beneath that namespace must be loaded.By default, discovery uses
ClassLoader.getResources(String)and does not inspect unrelated classpath roots. Use aLocalizedStringLoadingOptionsoverload with exhaustive classpath search enabled only for JARs that omit package directory entries. A classpath.jsonresource whose filename is not a locale tag is ignored with a warning; explicitly loaded filesystem directories containing localized strings files retain strict filename validation.- Parameters:
classpathPackage- location of a package on the classpath, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
IllegalArgumentException- ifclasspathPackageis invalid or names the reserved physical multi-release JAR namespaceLocalizedStringLoadingException- if an error occurs while loading localized strings files
-
loadFromClasspath
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromClasspath(@NonNull String classpathPackage, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads localized strings files from a classpath package using the specified loading and discovery options.- Parameters:
classpathPackage- location of a package on the classpath, not nullloadingOptions- loading and classpath-discovery options to apply, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
IllegalArgumentException- ifclasspathPackageis invalid or names the reserved physical multi-release JAR namespaceLocalizedStringLoadingException- if loading, discovery, validation, or a configured limit fails- Since:
- 3.0.0
-
loadFromClasspath
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromClasspath(@NonNull String classpathPackage, @NonNull LocalizedStringWarningHandler warningHandler) Loads all localized strings files present in the specified package, routing validation warnings to the given handler.- Parameters:
classpathPackage- location of a package on the classpath, not nullwarningHandler- handler for non-fatal validation warnings, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
IllegalArgumentException- ifclasspathPackageis invalid or names the reserved physical multi-release JAR namespaceLocalizedStringLoadingException- if an error occurs while loading localized strings files- Since:
- 3.0.0
-
loadFromClasspath
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromClasspath(@NonNull String classpathPackage, @NonNull LocalizedStringWarningHandler warningHandler, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads localized strings files from a classpath package with validation-warning, loading, and discovery policies.- Parameters:
classpathPackage- location of a package on the classpath, not nullwarningHandler- handler for non-fatal validation warnings, not nullloadingOptions- loading and classpath-discovery options to apply, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
IllegalArgumentException- ifclasspathPackageis invalid or names the reserved physical multi-release JAR namespaceLocalizedStringLoadingException- if loading, discovery, validation, or a configured limit fails- Since:
- 3.0.0
-
loadFromClasspath
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromClasspath(@NonNull ClassLoader classLoader, @NonNull String classpathPackage) Loads all localized strings files present in the specified package using the specified classloader.This is useful for containers, plugin systems, test harnesses, and other environments where the desired localized string resources are not visible to Lokalized's own defining classloader.
- Parameters:
classLoader- classloader to search, not nullclasspathPackage- location of a package on the classpath, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
IllegalArgumentException- ifclasspathPackageis invalid or names the reserved physical multi-release JAR namespaceLocalizedStringLoadingException- if an error occurs while loading localized strings files- Since:
- 3.0.0
-
loadFromClasspath
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromClasspath(@NonNull ClassLoader classLoader, @NonNull String classpathPackage, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads localized strings files using the specified classloader and loading/discovery options.- Parameters:
classLoader- classloader to search, not nullclasspathPackage- location of a package on the classpath, not nullloadingOptions- loading and classpath-discovery options to apply, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
IllegalArgumentException- ifclasspathPackageis invalid or names the reserved physical multi-release JAR namespaceLocalizedStringLoadingException- if loading, discovery, validation, or a configured limit fails- Since:
- 3.0.0
-
loadFromClasspath
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromClasspath(@NonNull ClassLoader classLoader, @NonNull String classpathPackage, @NonNull LocalizedStringWarningHandler warningHandler) Loads all localized strings files present in the specified package using the specified classloader, routing validation warnings to the given handler.- Parameters:
classLoader- classloader to search, not nullclasspathPackage- location of a package on the classpath, not nullwarningHandler- handler for non-fatal validation warnings, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
IllegalArgumentException- ifclasspathPackageis invalid or names the reserved physical multi-release JAR namespaceLocalizedStringLoadingException- if an error occurs while loading localized strings files- Since:
- 3.0.0
-
loadFromClasspath
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromClasspath(@NonNull ClassLoader classLoader, @NonNull String classpathPackage, @NonNull LocalizedStringWarningHandler warningHandler, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads localized strings files using the specified classloader, validation-warning policy, and loading/discovery options.- Parameters:
classLoader- classloader to search, not nullclasspathPackage- location of a package on the classpath, not nullwarningHandler- handler for non-fatal validation warnings, not nullloadingOptions- loading and classpath-discovery options to apply, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
IllegalArgumentException- ifclasspathPackageis invalid or names the reserved physical multi-release JAR namespaceLocalizedStringLoadingException- if loading, discovery, validation, or a configured limit fails- Since:
- 3.0.0
-
loadFromClasspathResources
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromClasspathResources(@NonNull Map<@NonNull Locale, @NonNull String> resourcePathByLocale) Loads explicitly mapped resources from the current thread context classloader usingClassLoader.getResourceAsStream(String). If no context classloader is set, Lokalized's defining classloader is used.Unlike package discovery, this API does not enumerate directories or depend on
file/jarURL protocols. It is therefore appropriate for containers, module systems, and plugin classloaders that can open known resources but cannot expose a scannable package URL. Resource paths must be nonempty slash-relative paths. Unlike package discovery, exact physical resources beneathMETA-INF/versionsare permitted.- Parameters:
resourcePathByLocale- exact classpath resource path for each locale, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
NullPointerException- if the mapping or any mapping key or value is nullIllegalArgumentException- if a locale key or resource path is invalidLocalizedStringLoadingException- if rendered locale tags collide, a resource cannot be loaded, parsed, or validated, or a configured loading limit is exceeded- Since:
- 3.0.0
-
loadFromClasspathResources
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromClasspathResources(@NonNull Map<@NonNull Locale, @NonNull String> resourcePathByLocale, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads explicitly mapped resources from the current thread context classloader with loading limits.- Parameters:
resourcePathByLocale- exact classpath resource path for each locale, not nullloadingOptions- resource limits to apply across the mapped resources, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
NullPointerException- if any argument or mapping key or value is nullIllegalArgumentException- if a locale key or resource path is invalidLocalizedStringLoadingException- if rendered locale tags collide, a resource cannot be loaded, parsed, or validated, or a configured loading limit is exceeded- Since:
- 3.0.0
-
loadFromClasspathResources
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromClasspathResources(@NonNull Map<@NonNull Locale, @NonNull String> resourcePathByLocale, @NonNull LocalizedStringWarningHandler warningHandler) Loads explicitly mapped resources from the current thread context classloader with a validation-warning policy.- Parameters:
resourcePathByLocale- exact classpath resource path for each locale, not nullwarningHandler- handler for non-fatal validation warnings, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
NullPointerException- if any argument or mapping key or value is nullIllegalArgumentException- if a locale key or resource path is invalidLocalizedStringLoadingException- if rendered locale tags collide, a resource cannot be loaded, parsed, or validated, or a configured loading limit is exceeded- Since:
- 3.0.0
-
loadFromClasspathResources
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromClasspathResources(@NonNull Map<@NonNull Locale, @NonNull String> resourcePathByLocale, @NonNull LocalizedStringWarningHandler warningHandler, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads explicitly mapped resources from the current thread context classloader with warning and loading policies.- Parameters:
resourcePathByLocale- exact classpath resource path for each locale, not nullwarningHandler- handler for non-fatal validation warnings, not nullloadingOptions- resource limits to apply across the mapped resources, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
NullPointerException- if any argument or mapping key or value is nullIllegalArgumentException- if a locale key or resource path is invalidLocalizedStringLoadingException- if rendered locale tags collide, a resource cannot be loaded, parsed, or validated, or a configured loading limit is exceeded- Since:
- 3.0.0
-
loadFromClasspathResources
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromClasspathResources(@NonNull ClassLoader classLoader, @NonNull Map<@NonNull Locale, @NonNull String> resourcePathByLocale) Loads explicitly mapped classpath resources usingClassLoader.getResourceAsStream(String).- Parameters:
classLoader- classloader from which to open resources, not nullresourcePathByLocale- exact classpath resource path for each locale, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
NullPointerException- if any argument or mapping key or value is nullIllegalArgumentException- if a locale key or resource path is invalidLocalizedStringLoadingException- if rendered locale tags collide, a resource cannot be loaded, parsed, or validated, or a configured loading limit is exceeded- Since:
- 3.0.0
-
loadFromClasspathResources
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromClasspathResources(@NonNull ClassLoader classLoader, @NonNull Map<@NonNull Locale, @NonNull String> resourcePathByLocale, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads explicitly mapped classpath resources with loading limits.- Parameters:
classLoader- classloader from which to open resources, not nullresourcePathByLocale- exact classpath resource path for each locale, not nullloadingOptions- resource limits to apply across the mapped resources, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
NullPointerException- if any argument or mapping key or value is nullIllegalArgumentException- if a locale key or resource path is invalidLocalizedStringLoadingException- if rendered locale tags collide, a resource cannot be loaded, parsed, or validated, or a configured loading limit is exceeded- Since:
- 3.0.0
-
loadFromClasspathResources
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromClasspathResources(@NonNull ClassLoader classLoader, @NonNull Map<@NonNull Locale, @NonNull String> resourcePathByLocale, @NonNull LocalizedStringWarningHandler warningHandler) Loads explicitly mapped classpath resources with a validation-warning policy.- Parameters:
classLoader- classloader from which to open resources, not nullresourcePathByLocale- exact classpath resource path for each locale, not nullwarningHandler- handler for non-fatal validation warnings, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
NullPointerException- if any argument or mapping key or value is nullIllegalArgumentException- if a locale key or resource path is invalidLocalizedStringLoadingException- if rendered locale tags collide, a resource cannot be loaded, parsed, or validated, or a configured loading limit is exceeded- Since:
- 3.0.0
-
loadFromClasspathResources
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromClasspathResources(@NonNull ClassLoader classLoader, @NonNull Map<@NonNull Locale, @NonNull String> resourcePathByLocale, @NonNull LocalizedStringWarningHandler warningHandler, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads explicitly mapped classpath resources with validation-warning and aggregate loading-limit policies.- Parameters:
classLoader- classloader from which to open resources, not nullresourcePathByLocale- exact classpath resource path for each locale, not nullwarningHandler- handler for non-fatal validation warnings, not nullloadingOptions- resource limits to apply across the mapped resources, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
NullPointerException- if any argument or mapping key or value is nullIllegalArgumentException- if a locale key or resource path is invalidLocalizedStringLoadingException- if rendered locale tags collide, a resource cannot be loaded, parsed, or validated, or a configured loading limit is exceeded- Since:
- 3.0.0
-
loadFromFilesystem
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromFilesystem(@NonNull Path directory) Loads all localized strings files present in the specified directory.Filenames must correspond to the IETF BCP 47 language tag format, optionally suffixed with
.json.Example filenames:
enen.jsones-MXes-MX.jsonnan-Hant-TW
Note: this implementation only scans the specified directory, it does not descend into child directories.
- Parameters:
directory- directory in which to search for localized strings files, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
LocalizedStringLoadingException- if an error occurs while loading localized strings files
-
loadFromFilesystem
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromFilesystem(@NonNull Path directory, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads localized strings files from a directory using the specified resource limits.- Parameters:
directory- directory in which to search, not nullloadingOptions- resource limits to apply, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
LocalizedStringLoadingException- if an error occurs while loading localized strings files- Since:
- 3.0.0
-
loadFromFilesystem
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromFilesystem(@NonNull Path directory, @NonNull LocalizedStringWarningHandler warningHandler) Loads all localized strings files present in the specified directory, routing validation warnings to the given handler.- Parameters:
directory- directory in which to search for localized strings files, not nullwarningHandler- handler for non-fatal validation warnings, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
LocalizedStringLoadingException- if an error occurs while loading localized strings files- Since:
- 3.0.0
-
loadFromFilesystem
public static @NonNull Map<@NonNull Locale, @NonNull Set<@NonNull LocalizedString>> loadFromFilesystem(@NonNull Path directory, @NonNull LocalizedStringWarningHandler warningHandler, @NonNull LocalizedStringLoadingOptions loadingOptions) Loads localized strings files from a directory with validation-warning and resource-limit policies.- Parameters:
directory- directory in which to search, not nullwarningHandler- handler for non-fatal validation warnings, not nullloadingOptions- resource limits to apply, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
LocalizedStringLoadingException- if an error occurs while loading localized strings files- Since:
- 3.0.0
-
parse
public static @NonNull Set<@NonNull LocalizedString> parse(@NonNull Path path, @NonNull Locale locale) Parses one localized strings file for the given locale.- Parameters:
path- file to parse, not nulllocale- locale represented by the file, not null- Returns:
- unmodifiable localized strings contained in the file, not null
- Throws:
IllegalArgumentException- iflocaleis not a well-formed IETF BCP 47 localeLocalizedStringLoadingException- if the file cannot be read or is invalid- Since:
- 3.0.0
-
parse
public static @NonNull Set<@NonNull LocalizedString> parse(@NonNull Path path, @NonNull Locale locale, @NonNull LocalizedStringWarningHandler warningHandler, @NonNull LocalizedStringLoadingOptions loadingOptions) Parses one localized strings file with validation-warning and resource-limit policies.- Parameters:
path- file to parse, not nulllocale- locale represented by the file, not nullwarningHandler- handler for non-fatal validation warnings, not nullloadingOptions- resource limits to apply, not null- Returns:
- unmodifiable localized strings contained in the file, not null
- Throws:
IllegalArgumentException- iflocaleis not a well-formed IETF BCP 47 localeLocalizedStringLoadingException- if the file cannot be read or is invalid- Since:
- 3.0.0
-
parse
public static @NonNull Set<@NonNull LocalizedString> parse(@NonNull InputStream inputStream, @NonNull Locale locale, @NonNull String source) Parses one UTF-8 localized strings resource for the given locale. This method does not close the stream.- Parameters:
inputStream- UTF-8 resource contents, not nulllocale- locale represented by the resource, not nullsource- human-readable source identifier used in diagnostics, not null- Returns:
- unmodifiable localized strings contained in the resource, not null
- Throws:
IllegalArgumentException- iflocaleis not a well-formed IETF BCP 47 localeLocalizedStringLoadingException- if the resource cannot be read or is invalid UTF-8/JSON- Since:
- 3.0.0
-
parse
public static @NonNull Set<@NonNull LocalizedString> parse(@NonNull InputStream inputStream, @NonNull Locale locale, @NonNull String source, @NonNull LocalizedStringWarningHandler warningHandler, @NonNull LocalizedStringLoadingOptions loadingOptions) Parses one UTF-8 localized strings resource with validation-warning and resource-limit policies. This method does not close the stream.- Parameters:
inputStream- UTF-8 resource contents, not nulllocale- locale represented by the resource, not nullsource- human-readable source identifier used in diagnostics, not nullwarningHandler- handler for non-fatal validation warnings, not nullloadingOptions- resource limits to apply, not null- Returns:
- unmodifiable localized strings contained in the resource, not null
- Throws:
IllegalArgumentException- iflocaleis not a well-formed IETF BCP 47 localeLocalizedStringLoadingException- if the resource cannot be read or is invalid UTF-8/JSON- Since:
- 3.0.0
-
parse
public static @NonNull Set<@NonNull LocalizedString> parse(@NonNull Reader reader, @NonNull Locale locale, @NonNull String source) Parses one localized strings character resource for the given locale. This method does not close the reader.- Parameters:
reader- character resource contents, not nulllocale- locale represented by the resource, not nullsource- human-readable source identifier used in diagnostics, not null- Returns:
- unmodifiable localized strings contained in the resource, not null
- Throws:
IllegalArgumentException- iflocaleis not a well-formed IETF BCP 47 localeLocalizedStringLoadingException- if the resource cannot be read or is invalid- Since:
- 3.0.0
-
parse
public static @NonNull Set<@NonNull LocalizedString> parse(@NonNull Reader reader, @NonNull Locale locale, @NonNull String source, @NonNull LocalizedStringWarningHandler warningHandler, @NonNull LocalizedStringLoadingOptions loadingOptions) Parses one localized strings character resource with validation-warning and resource-limit policies. This method does not close the reader.- Parameters:
reader- character resource contents, not nulllocale- locale represented by the resource, not nullsource- human-readable source identifier used in diagnostics, not nullwarningHandler- handler for non-fatal validation warnings, not nullloadingOptions- resource limits to apply, not null- Returns:
- unmodifiable localized strings contained in the resource, not null
- Throws:
IllegalArgumentException- iflocaleis not a well-formed IETF BCP 47 localeLocalizedStringLoadingException- if the resource cannot be read or is invalid- Since:
- 3.0.0
-