Erwin Müller Blog

POSIX Locale for Java

The Locale class in Java is very powerful and useful, but it is different from the locale that is used on POSIX systems. The POSIX locale is described to contain the language, country and the code set, which translates to Java as the Locale class and the Charset class. My globalpomutils-core module offers now in the 2.6 version the class PosixLocale that maps POSIX locale language, country and the code set as a Java class. In addition, the class PosixLocaleFormat can parse the format language[_territory][.codeset] of the given POSIX locale.

Examples

The factory class PosixLocaleFactory can be used to create a new POSIX locale object as described below.

The POSIX locale can be parsed and formatted via the PosixLocaleFormat class. The PosixLocaleFormatModule provides various factory methods to create the POSIX locale format.

Leave a Reply