33 import java.io.FileNotFoundException; 34 import java.io.Flushable; 35 import java.io.OutputStream; 36 import java.io.OutputStreamWriter; 37 import java.io.PrintStream; 38 import java.io.UnsupportedEncodingException; 39 import java.math.BigDecimal; 40 import java.math.BigInteger; 41 import java.math.MathContext; 42 import java.math.RoundingMode; 43 import java.nio.charset.Charset; 44 import java.nio.charset.IllegalCharsetNameException; 45 import java.nio.charset.UnsupportedCharsetException; 46 import java.text.DateFormatSymbols; 47 import java.text.DecimalFormat; 48 import java.text.DecimalFormatSymbols; 49 import java.text.NumberFormat; 50 import java.util.regex.Matcher; 51 import java.util.regex.Pattern; 52 53 import java.time.Clock; 54 import java.time.DateTimeException; 55 import java.time.Instant; 56 import java.time.ZoneId; 57 import java.time.ZoneOffset; 58 import java.time.temporal.ChronoField; 59 import java.time.temporal.TemporalAccessor; 60 import java.time.temporal.Queries; 61 import java.time.temporal.OffsetDate; 62 import java.time.temporal.OffsetDateTime; 63 import java.time.temporal.OffsetTime; 64 import java.time.temporal.ChronoZonedDateTime; 65 import java.time.format.TextStyle; 66 import java.time.zone.ZoneRules; 67 68 import sun.misc.DoubleConsts; 69 import sun.misc.FormattedFloatingDecimal; 70 71 /** 72 * An interpreter for printf-style format strings. This class provides support 73 * for layout justification and alignment, common formats for numeric, string, 74 * and date/time data, and locale-specific output. Common Java types such as 75 * {@code byte}, {@link java.math.BigDecimal BigDecimal}, and {@link Calendar} 76 * are supported. Limited formatting customization for arbitrary user types is 77 * provided through the {@link Formattable} interface. 78 * 79 * <p> Formatters are not necessarily safe for multithreaded access. Thread 80 * safety is optional and is the responsibility of users of methods in this 81 * class. 82 * 83 * <p> Formatted printing for the Java language is heavily inspired by C's 84 * {@code printf}. Although the format strings are similar to C, some 85 * customizations have been made to accommodate the Java language and exploit 86 * some of its features. Also, Java formatting is more strict than C's; for | 33 import java.io.FileNotFoundException; 34 import java.io.Flushable; 35 import java.io.OutputStream; 36 import java.io.OutputStreamWriter; 37 import java.io.PrintStream; 38 import java.io.UnsupportedEncodingException; 39 import java.math.BigDecimal; 40 import java.math.BigInteger; 41 import java.math.MathContext; 42 import java.math.RoundingMode; 43 import java.nio.charset.Charset; 44 import java.nio.charset.IllegalCharsetNameException; 45 import java.nio.charset.UnsupportedCharsetException; 46 import java.text.DateFormatSymbols; 47 import java.text.DecimalFormat; 48 import java.text.DecimalFormatSymbols; 49 import java.text.NumberFormat; 50 import java.util.regex.Matcher; 51 import java.util.regex.Pattern; 52 53 import java.time.DateTimeException; 54 import java.time.Instant; 55 import java.time.ZoneId; 56 import java.time.ZoneOffset; 57 import java.time.temporal.ChronoField; 58 import java.time.temporal.TemporalAccessor; 59 import java.time.temporal.Queries; 60 61 import sun.misc.DoubleConsts; 62 import sun.misc.FormattedFloatingDecimal; 63 64 /** 65 * An interpreter for printf-style format strings. This class provides support 66 * for layout justification and alignment, common formats for numeric, string, 67 * and date/time data, and locale-specific output. Common Java types such as 68 * {@code byte}, {@link java.math.BigDecimal BigDecimal}, and {@link Calendar} 69 * are supported. Limited formatting customization for arbitrary user types is 70 * provided through the {@link Formattable} interface. 71 * 72 * <p> Formatters are not necessarily safe for multithreaded access. Thread 73 * safety is optional and is the responsibility of users of methods in this 74 * class. 75 * 76 * <p> Formatted printing for the Java language is heavily inspired by C's 77 * {@code printf}. Although the format strings are similar to C, some 78 * customizations have been made to accommodate the Java language and exploit 79 * some of its features. Also, Java formatting is more strict than C's; for |