2712N/A * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved 0N/A * (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved 0N/A * The original version of this source code and documentation is copyrighted 0N/A * and owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These 0N/A * materials are provided under terms of a License Agreement between Taligent 0N/A * and Sun. This technology is protected by multiple US and International 0N/A * patents. This notice and attribution to Taligent may not be removed. 0N/A * Taligent is a registered trademark of Taligent, Inc. 0N/A * This class represents the set of symbols (such as the decimal separator, 0N/A * the grouping separator, and so on) needed by <code>DecimalFormat</code> 0N/A * to format numbers. <code>DecimalFormat</code> creates for itself an instance of 0N/A * <code>DecimalFormatSymbols</code> from its locale data. If you need to change any 0N/A * of these symbols, you can get the <code>DecimalFormatSymbols</code> object from 0N/A * your <code>DecimalFormat</code> and modify it. 0N/A * @see java.util.Locale 0N/A * @see DecimalFormat 0N/A * @author Mark Davis 0N/A * Create a DecimalFormatSymbols object for the default locale. 0N/A * This constructor can only construct instances for the locales 0N/A * supported by the Java runtime environment, not for those 0N/A * supported by installed 0N/A * {@link java.text.spi.DecimalFormatSymbolsProvider DecimalFormatSymbolsProvider} 0N/A * implementations. For full locale coverage, use the 0N/A * {@link #getInstance(Locale) getInstance} method. 0N/A * Create a DecimalFormatSymbols object for the given locale. 0N/A * This constructor can only construct instances for the locales 0N/A * supported by the Java runtime environment, not for those 0N/A * supported by installed 0N/A * {@link java.text.spi.DecimalFormatSymbolsProvider DecimalFormatSymbolsProvider} 0N/A * implementations. For full locale coverage, use the 0N/A * {@link #getInstance(Locale) getInstance} method. 0N/A * @exception NullPointerException if <code>locale</code> is null 0N/A * Returns an array of all locales for which the 0N/A * <code>getInstance</code> methods of this class can return 0N/A * localized instances. 0N/A * The returned array represents the union of locales supported by the Java 0N/A * runtime and by installed 0N/A * {@link java.text.spi.DecimalFormatSymbolsProvider DecimalFormatSymbolsProvider} 0N/A * implementations. It must contain at least a <code>Locale</code> 0N/A * instance equal to {@link java.util.Locale#US Locale.US}. 0N/A * @return An array of locales for which localized 0N/A * <code>DecimalFormatSymbols</code> instances are available. 0N/A * Gets the <code>DecimalFormatSymbols</code> instance for the default 0N/A * locale. This method provides access to <code>DecimalFormatSymbols</code> 0N/A * instances for locales supported by the Java runtime itself as well 0N/A * as for those supported by installed 0N/A * {@link java.text.spi.DecimalFormatSymbolsProvider 0N/A * DecimalFormatSymbolsProvider} implementations. 0N/A * @return a <code>DecimalFormatSymbols</code> instance. 0N/A * Gets the <code>DecimalFormatSymbols</code> instance for the specified 0N/A * locale. This method provides access to <code>DecimalFormatSymbols</code> 0N/A * instances for locales supported by the Java runtime itself as well 0N/A * as for those supported by installed 0N/A * {@link java.text.spi.DecimalFormatSymbolsProvider 0N/A * DecimalFormatSymbolsProvider} implementations. 0N/A * @param locale the desired locale. 0N/A * @return a <code>DecimalFormatSymbols</code> instance. 0N/A * @exception NullPointerException if <code>locale</code> is null 0N/A // Check whether a provider can provide an implementation that's closer 0N/A // to the requested locale than what the Java runtime itself can provide. 0N/A * Gets the character used for zero. Different for Arabic, etc. 0N/A * Sets the character used for zero. Different for Arabic, etc. 0N/A * Gets the character used for thousands separator. Different for French, etc. 0N/A * Sets the character used for thousands separator. Different for French, etc. 0N/A * Gets the character used for decimal sign. Different for French, etc. 0N/A * Sets the character used for decimal sign. Different for French, etc. 0N/A * Gets the character used for per mille sign. Different for Arabic, etc. 0N/A * Sets the character used for per mille sign. Different for Arabic, etc. 0N/A * Gets the character used for percent sign. Different for Arabic, etc. 0N/A * Sets the character used for percent sign. Different for Arabic, etc. 0N/A * Gets the character used for a digit in a pattern. 0N/A * Sets the character used for a digit in a pattern. 0N/A * Gets the character used to separate positive and negative subpatterns 0N/A * Sets the character used to separate positive and negative subpatterns 0N/A * Gets the string used to represent infinity. Almost always left 0N/A * Sets the string used to represent infinity. Almost always left 0N/A * Gets the string used to represent "not a number". Almost always left 0N/A * Sets the string used to represent "not a number". Almost always left 0N/A * Gets the character used to represent minus sign. If no explicit 0N/A * negative format is specified, one is formed by prefixing 0N/A * minusSign to the positive format. 0N/A * Sets the character used to represent minus sign. If no explicit 0N/A * negative format is specified, one is formed by prefixing 0N/A * minusSign to the positive format. 0N/A * Returns the currency symbol for the currency of these 0N/A * DecimalFormatSymbols in their locale. 0N/A * Sets the currency symbol for the currency of these 0N/A * DecimalFormatSymbols in their locale. 0N/A * Returns the ISO 4217 currency code of the currency of these 0N/A * DecimalFormatSymbols. 0N/A * Sets the ISO 4217 currency code of the currency of these 0N/A * DecimalFormatSymbols. 0N/A * If the currency code is valid (as defined by 0N/A * {@link java.util.Currency#getInstance(java.lang.String) Currency.getInstance}), 0N/A * this also sets the currency attribute to the corresponding Currency 0N/A * instance and the currency symbol attribute to the currency's symbol 0N/A * in the DecimalFormatSymbols' locale. If the currency code is not valid, 0N/A * then the currency attribute is set to null and the currency symbol 0N/A * attribute is not modified. 0N/A * @see #setCurrencySymbol 0N/A * Gets the currency of these DecimalFormatSymbols. May be null if the 0N/A * currency symbol attribute was previously set to a value that's not 0N/A * a valid ISO 4217 currency code. 0N/A * @return the currency used, or null 0N/A * Sets the currency of these DecimalFormatSymbols. 0N/A * This also sets the currency symbol attribute to the currency's symbol 0N/A * in the DecimalFormatSymbols' locale, and the international currency 0N/A * symbol attribute to the currency's ISO 4217 currency code. 0N/A * @param currency the new currency to be used 0N/A * @exception NullPointerException if <code>currency</code> is null 0N/A * @see #setCurrencySymbol 0N/A * @see #setInternationalCurrencySymbol 0N/A * Returns the monetary decimal separator. 0N/A * Sets the monetary decimal separator. 0N/A //------------------------------------------------------------ 0N/A // BEGIN Package Private methods ... to be made public later 0N/A //------------------------------------------------------------ 0N/A * Returns the character used to separate the mantissa from the exponent. 0N/A * Returns the string used to separate the mantissa from the exponent. 0N/A * Examples: "x10^" for 1.23x10^4, "E" for 1.23E4. 0N/A * @return the exponent separator string 0N/A * @see #setExponentSeparator(java.lang.String) 0N/A * Sets the character used to separate the mantissa from the exponent. 0N/A * Sets the string used to separate the mantissa from the exponent. 0N/A * Examples: "x10^" for 1.23x10^4, "E" for 1.23E4. 0N/A * @param exp the exponent separator string 0N/A * @exception NullPointerException if <code>exp</code> is null 0N/A * @see #getExponentSeparator() 0N/A //------------------------------------------------------------ 0N/A // END Package Private methods ... to be made public later 0N/A //------------------------------------------------------------ 0N/A * Standard override. 0N/A // other fields are bit-copied 0N/A * Override hashCode. 0N/A * Initializes the symbols from the FormatData resource bundle. 0N/A // get resource bundle data - try the cache first 2712N/A // When numbering system is thai (Locale's extension contains u-nu-thai), 2712N/A // we read the data from th_TH_TH. 0N/A // Try to obtain the currency used in the locale's country. 0N/A // Check for empty country string separately because it's a valid 0N/A // country ID for Locale (and used for the C locale), but not a valid 0N/A // ISO 3166 country code, and exceptions are expensive. 0N/A // use default values below for compatibility 0N/A // Currently the monetary decimal separator is the same as the 0N/A // standard decimal separator for all locales that we support. 0N/A // If that changes, add a new entry to NumberElements. 0N/A * Reads the default serializable fields, provides default values for objects 0N/A * in older serial versions, and initializes non-serializable fields. 0N/A * If <code>serialVersionOnStream</code> 0N/A * is less than 1, initializes <code>monetarySeparator</code> to be 0N/A * the same as <code>decimalSeparator</code> and <code>exponential</code> 0N/A * If <code>serialVersionOnStream</code> is less than 2, 0N/A * initializes <code>locale</code>to the root locale, and initializes 0N/A * If <code>serialVersionOnStream</code> is less than 3, it initializes 0N/A * <code>exponentialSeparator</code> using <code>exponential</code>. 0N/A * Sets <code>serialVersionOnStream</code> back to the maximum allowed value so that 0N/A * default serialization will work properly if this object is streamed out again. 0N/A * Initializes the currency from the intlCurrencySymbol field. 0N/A // Didn't have monetarySeparator or exponential field; 0N/A // didn't have locale; use root locale 0N/A // didn't have exponentialSeparator. Create one using exponential 0N/A * Character used for zero. 0N/A * @see #getZeroDigit 0N/A * Character used for thousands separator. 0N/A * @see #getGroupingSeparator 0N/A * Character used for decimal sign. 0N/A * @see #getDecimalSeparator 0N/A * Character used for per mille sign. 0N/A * Character used for percent sign. 0N/A * Character used for a digit in a pattern. 0N/A * Character used to separate positive and negative subpatterns 0N/A * @see #getPatternSeparator 0N/A * String used to represent infinity. 0N/A * String used to represent "not a number". 0N/A * Character used to represent minus sign. 0N/A * @see #getMinusSign 0N/A * String denoting the local currency, e.g. "$". 0N/A * @see #getCurrencySymbol 0N/A * ISO 4217 currency code denoting the local currency, e.g. "USD". 0N/A * @see #getInternationalCurrencySymbol 0N/A * The decimal separator used when formatting currency values. 0N/A * @see #getMonetaryDecimalSeparator 0N/A * The character used to distinguish the exponent in a number formatted 0N/A * in exponential notation, e.g. 'E' for a number such as "1.23E45". 0N/A * Note that the public API provides no way to set this field, 0N/A * even though it is supported by the implementation and the stream format. 0N/A * The intent is that this will be added to the API in the future. 0N/A * The string used to separate the mantissa from the exponent. 0N/A * Examples: "x10^" for 1.23x10^4, "E" for 1.23E4. 0N/A * If both <code>exponential</code> and <code>exponentialSeparator</code> 0N/A * exist, this <code>exponentialSeparator</code> has the precedence. 0N/A * The locale of these currency format symbols. 0N/A // currency; only the ISO code is serialized. 0N/A // Proclaim JDK 1.1 FCS compatibility 0N/A // The internal serial version which says which version was written 0N/A // - 0 (default) for version up to JDK 1.1.5 0N/A // - 1 for version from JDK 1.1.6, which includes two new fields: 0N/A // monetarySeparator and exponential. 0N/A // - 2 for version from J2SE 1.4, which includes locale field. 0N/A // - 3 for version from J2SE 1.6, which includes exponentialSeparator field. 0N/A * Describes the version of <code>DecimalFormatSymbols</code> present on the stream. 0N/A * Possible values are: 0N/A * <li><b>0</b> (or uninitialized): versions prior to JDK 1.1.6. 0N/A * <li><b>1</b>: Versions written by JDK 1.1.6 or later, which include 0N/A * two new fields: <code>monetarySeparator</code> and <code>exponential</code>. 0N/A * <li><b>2</b>: Versions written by J2SE 1.4 or later, which include a 0N/A * new <code>locale</code> field. 0N/A * <li><b>3</b>: Versions written by J2SE 1.6 or later, which include a 0N/A * new <code>exponentialSeparator</code> field. 0N/A * When streaming out a <code>DecimalFormatSymbols</code>, the most recent format 0N/A * (corresponding to the highest allowable <code>serialVersionOnStream</code>) 0N/A * is always written. 0N/A * cache to hold the NumberElements and the Currency 0N/A * Obtains a DecimalFormatSymbols instance from a DecimalFormatSymbolsProvider