< prev index next >

src/java.base/share/classes/java/text/DecimalFormatSymbols.java

Print this page




 835      * If {@code serialVersionOnStream}
 836      * is less than 1, initializes {@code monetarySeparator} to be
 837      * the same as {@code decimalSeparator} and {@code exponential}
 838      * to be 'E'.
 839      * If {@code serialVersionOnStream} is less than 2,
 840      * initializes {@code locale}to the root locale, and initializes
 841      * If {@code serialVersionOnStream} is less than 3, it initializes
 842      * {@code exponentialSeparator} using {@code exponential}.
 843      * If {@code serialVersionOnStream} is less than 4, it initializes
 844      * {@code perMillText}, {@code percentText}, and
 845      * {@code minusSignText} using {@code perMill}, {@code percent}, and
 846      * {@code minusSign} respectively.
 847      * Sets {@code serialVersionOnStream} back to the maximum allowed value so that
 848      * default serialization will work properly if this object is streamed out again.
 849      * Initializes the currency from the intlCurrencySymbol field.
 850      *
 851      * @throws InvalidObjectException if {@code char} and {@code String}
 852      *      representations of either percent, per mille, and/or minus sign disagree.
 853      * @since  1.1.6
 854      */

 855     private void readObject(ObjectInputStream stream)
 856             throws IOException, ClassNotFoundException {
 857         stream.defaultReadObject();
 858         if (serialVersionOnStream < 1) {
 859             // Didn't have monetarySeparator or exponential field;
 860             // use defaults.
 861             monetarySeparator = decimalSeparator;
 862             exponential       = 'E';
 863         }
 864         if (serialVersionOnStream < 2) {
 865             // didn't have locale; use root locale
 866             locale = Locale.ROOT;
 867         }
 868         if (serialVersionOnStream < 3) {
 869             // didn't have exponentialSeparator. Create one using exponential
 870             exponentialSeparator = Character.toString(exponential);
 871         }
 872         if (serialVersionOnStream < 4) {
 873             // didn't have perMillText, percentText, and minusSignText.
 874             // Create one using corresponding char variations.


1050      * @since 13
1051      */
1052     private  String percentText;
1053 
1054     /**
1055      * String representation of minus sign, which may include
1056      * formatting characters, such as BiDi control characters.
1057      * The first non-format character of this string is the same as
1058      * {@code minusSign}.
1059      *
1060      * @serial
1061      * @since 13
1062      */
1063     private  String minusSignText;
1064 
1065     // currency; only the ISO code is serialized.
1066     private transient Currency currency;
1067     private transient volatile boolean currencyInitialized;
1068 
1069     // Proclaim JDK 1.1 FCS compatibility

1070     static final long serialVersionUID = 5772796243397350300L;
1071 
1072     // The internal serial version which says which version was written
1073     // - 0 (default) for version up to JDK 1.1.5
1074     // - 1 for version from JDK 1.1.6, which includes two new fields:
1075     //     monetarySeparator and exponential.
1076     // - 2 for version from J2SE 1.4, which includes locale field.
1077     // - 3 for version from J2SE 1.6, which includes exponentialSeparator field.
1078     // - 4 for version from Java SE 13, which includes perMillText, percentText,
1079     //      and minusSignText field.
1080     private static final int currentSerialVersion = 4;
1081 
1082     /**
1083      * Describes the version of {@code DecimalFormatSymbols} present on the stream.
1084      * Possible values are:
1085      * <ul>
1086      * <li><b>0</b> (or uninitialized): versions prior to JDK 1.1.6.
1087      *
1088      * <li><b>1</b>: Versions written by JDK 1.1.6 or later, which include
1089      *      two new fields: {@code monetarySeparator} and {@code exponential}.


 835      * If {@code serialVersionOnStream}
 836      * is less than 1, initializes {@code monetarySeparator} to be
 837      * the same as {@code decimalSeparator} and {@code exponential}
 838      * to be 'E'.
 839      * If {@code serialVersionOnStream} is less than 2,
 840      * initializes {@code locale}to the root locale, and initializes
 841      * If {@code serialVersionOnStream} is less than 3, it initializes
 842      * {@code exponentialSeparator} using {@code exponential}.
 843      * If {@code serialVersionOnStream} is less than 4, it initializes
 844      * {@code perMillText}, {@code percentText}, and
 845      * {@code minusSignText} using {@code perMill}, {@code percent}, and
 846      * {@code minusSign} respectively.
 847      * Sets {@code serialVersionOnStream} back to the maximum allowed value so that
 848      * default serialization will work properly if this object is streamed out again.
 849      * Initializes the currency from the intlCurrencySymbol field.
 850      *
 851      * @throws InvalidObjectException if {@code char} and {@code String}
 852      *      representations of either percent, per mille, and/or minus sign disagree.
 853      * @since  1.1.6
 854      */
 855     @java.io.Serial
 856     private void readObject(ObjectInputStream stream)
 857             throws IOException, ClassNotFoundException {
 858         stream.defaultReadObject();
 859         if (serialVersionOnStream < 1) {
 860             // Didn't have monetarySeparator or exponential field;
 861             // use defaults.
 862             monetarySeparator = decimalSeparator;
 863             exponential       = 'E';
 864         }
 865         if (serialVersionOnStream < 2) {
 866             // didn't have locale; use root locale
 867             locale = Locale.ROOT;
 868         }
 869         if (serialVersionOnStream < 3) {
 870             // didn't have exponentialSeparator. Create one using exponential
 871             exponentialSeparator = Character.toString(exponential);
 872         }
 873         if (serialVersionOnStream < 4) {
 874             // didn't have perMillText, percentText, and minusSignText.
 875             // Create one using corresponding char variations.


1051      * @since 13
1052      */
1053     private  String percentText;
1054 
1055     /**
1056      * String representation of minus sign, which may include
1057      * formatting characters, such as BiDi control characters.
1058      * The first non-format character of this string is the same as
1059      * {@code minusSign}.
1060      *
1061      * @serial
1062      * @since 13
1063      */
1064     private  String minusSignText;
1065 
1066     // currency; only the ISO code is serialized.
1067     private transient Currency currency;
1068     private transient volatile boolean currencyInitialized;
1069 
1070     // Proclaim JDK 1.1 FCS compatibility
1071     @java.io.Serial
1072     static final long serialVersionUID = 5772796243397350300L;
1073 
1074     // The internal serial version which says which version was written
1075     // - 0 (default) for version up to JDK 1.1.5
1076     // - 1 for version from JDK 1.1.6, which includes two new fields:
1077     //     monetarySeparator and exponential.
1078     // - 2 for version from J2SE 1.4, which includes locale field.
1079     // - 3 for version from J2SE 1.6, which includes exponentialSeparator field.
1080     // - 4 for version from Java SE 13, which includes perMillText, percentText,
1081     //      and minusSignText field.
1082     private static final int currentSerialVersion = 4;
1083 
1084     /**
1085      * Describes the version of {@code DecimalFormatSymbols} present on the stream.
1086      * Possible values are:
1087      * <ul>
1088      * <li><b>0</b> (or uninitialized): versions prior to JDK 1.1.6.
1089      *
1090      * <li><b>1</b>: Versions written by JDK 1.1.6 or later, which include
1091      *      two new fields: {@code monetarySeparator} and {@code exponential}.
< prev index next >