< prev index next >

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

Print this page




3853      * the setters for the minimum and maximum integer and fraction digits with
3854      * the values of the corresponding superclass getters to initialize the
3855      * fields in this class. The fields in this class are new with version 3.
3856      * <li>
3857      * If {@code serialVersionOnStream} is less than 1, indicating that
3858      * the stream was written by JDK 1.1, initialize
3859      * {@code useExponentialNotation}
3860      * to false, since it was not present in JDK 1.1.
3861      * <li>
3862      * Set {@code serialVersionOnStream} to the maximum allowed value so
3863      * that default serialization will work properly if this object is streamed
3864      * out again.
3865      * </ol>
3866      *
3867      * <p>Stream versions older than 2 will not have the affix pattern variables
3868      * {@code posPrefixPattern} etc.  As a result, they will be initialized
3869      * to {@code null}, which means the affix strings will be taken as
3870      * literal values.  This is exactly what we want, since that corresponds to
3871      * the pre-version-2 behavior.
3872      */

3873     private void readObject(ObjectInputStream stream)
3874          throws IOException, ClassNotFoundException
3875     {
3876         stream.defaultReadObject();
3877         digitList = new DigitList();
3878 
3879         // We force complete fast-path reinitialization when the instance is
3880         // deserialized. See clone() comment on fastPathCheckNeeded.
3881         fastPathCheckNeeded = true;
3882         isFastPath = false;
3883         fastPathData = null;
3884 
3885         if (serialVersionOnStream < 4) {
3886             setRoundingMode(RoundingMode.HALF_EVEN);
3887         } else {
3888             setRoundingMode(getRoundingMode());
3889         }
3890 
3891         // We only need to check the maximum counts because NumberFormat
3892         // .readObject has already ensured that the maximum is greater than the


4326      * CURRENCY_SIGN is seen in a pattern, then the decimal separator is
4327      * replaced with the monetary decimal separator.
4328      *
4329      * The CURRENCY_SIGN is not localized.
4330      */
4331     private static final char       CURRENCY_SIGN = '\u00A4';
4332 
4333     private static final char       QUOTE = '\'';
4334 
4335     private static FieldPosition[] EmptyFieldPositionArray = new FieldPosition[0];
4336 
4337     // Upper limit on integer and fraction digits for a Java double
4338     static final int DOUBLE_INTEGER_DIGITS  = 309;
4339     static final int DOUBLE_FRACTION_DIGITS = 340;
4340 
4341     // Upper limit on integer and fraction digits for BigDecimal and BigInteger
4342     static final int MAXIMUM_INTEGER_DIGITS  = Integer.MAX_VALUE;
4343     static final int MAXIMUM_FRACTION_DIGITS = Integer.MAX_VALUE;
4344 
4345     // Proclaim JDK 1.1 serial compatibility.

4346     static final long serialVersionUID = 864413376551465018L;
4347 }


3853      * the setters for the minimum and maximum integer and fraction digits with
3854      * the values of the corresponding superclass getters to initialize the
3855      * fields in this class. The fields in this class are new with version 3.
3856      * <li>
3857      * If {@code serialVersionOnStream} is less than 1, indicating that
3858      * the stream was written by JDK 1.1, initialize
3859      * {@code useExponentialNotation}
3860      * to false, since it was not present in JDK 1.1.
3861      * <li>
3862      * Set {@code serialVersionOnStream} to the maximum allowed value so
3863      * that default serialization will work properly if this object is streamed
3864      * out again.
3865      * </ol>
3866      *
3867      * <p>Stream versions older than 2 will not have the affix pattern variables
3868      * {@code posPrefixPattern} etc.  As a result, they will be initialized
3869      * to {@code null}, which means the affix strings will be taken as
3870      * literal values.  This is exactly what we want, since that corresponds to
3871      * the pre-version-2 behavior.
3872      */
3873     @java.io.Serial
3874     private void readObject(ObjectInputStream stream)
3875          throws IOException, ClassNotFoundException
3876     {
3877         stream.defaultReadObject();
3878         digitList = new DigitList();
3879 
3880         // We force complete fast-path reinitialization when the instance is
3881         // deserialized. See clone() comment on fastPathCheckNeeded.
3882         fastPathCheckNeeded = true;
3883         isFastPath = false;
3884         fastPathData = null;
3885 
3886         if (serialVersionOnStream < 4) {
3887             setRoundingMode(RoundingMode.HALF_EVEN);
3888         } else {
3889             setRoundingMode(getRoundingMode());
3890         }
3891 
3892         // We only need to check the maximum counts because NumberFormat
3893         // .readObject has already ensured that the maximum is greater than the


4327      * CURRENCY_SIGN is seen in a pattern, then the decimal separator is
4328      * replaced with the monetary decimal separator.
4329      *
4330      * The CURRENCY_SIGN is not localized.
4331      */
4332     private static final char       CURRENCY_SIGN = '\u00A4';
4333 
4334     private static final char       QUOTE = '\'';
4335 
4336     private static FieldPosition[] EmptyFieldPositionArray = new FieldPosition[0];
4337 
4338     // Upper limit on integer and fraction digits for a Java double
4339     static final int DOUBLE_INTEGER_DIGITS  = 309;
4340     static final int DOUBLE_FRACTION_DIGITS = 340;
4341 
4342     // Upper limit on integer and fraction digits for BigDecimal and BigInteger
4343     static final int MAXIMUM_INTEGER_DIGITS  = Integer.MAX_VALUE;
4344     static final int MAXIMUM_FRACTION_DIGITS = Integer.MAX_VALUE;
4345 
4346     // Proclaim JDK 1.1 serial compatibility.
4347     @java.io.Serial
4348     static final long serialVersionUID = 864413376551465018L;
4349 }
< prev index next >