Searched refs:formatter (Results 1 - 25 of 43) sorted by relevance

12

/libcore/luni/src/test/java/libcore/java/time/format/
H A DDateTimeFormatterBuilderTest.java44 DateTimeFormatter formatter = new DateTimeFormatterBuilder()
47 assertEquals("<2000-12-31>", formatter.format(LocalDate.of(2000, Month.DECEMBER, 31)));
52 DateTimeFormatter formatter =
56 formatter.format(ZonedDateTime.now(ZoneId.of("Europe/London"))));
58 formatter.format(ZonedDateTime.now(ZoneId.of("UTC"))));
63 DateTimeFormatter formatter =
67 formatter.format(OffsetDateTime.now(ZoneOffset.UTC));
68 fail("Formatted ZoneOffset using appendZoneRegionId formatter");
75 DateTimeFormatter formatter = new DateTimeFormatterBuilder().appendZoneRegionId()
79 formatter
[all...]
H A DDateTimeFormatterTest.java51 for (DateTimeFormatter formatter : formatters) {
53 assertEquals(formatter.toString(), DecimalStyle.STANDARD, formatter.getDecimalStyle());
55 DateTimeFormatter arStyleFormatter = formatter.withDecimalStyle(arDecimalStyle);
59 // Verify that calling withDecimalStyle() doesn't modify the original formatter.
60 assertEquals(formatter.toString(), DecimalStyle.STANDARD, formatter.getDecimalStyle());
/libcore/ojluni/src/main/java/java/util/
H A DFormattable.java122 * Formats the object using the provided {@link Formatter formatter}.
124 * @param formatter
125 * The {@link Formatter formatter}. Implementing classes may call
126 * {@link Formatter#out() formatter.out()} or {@link
127 * Formatter#locale() formatter.locale()} to obtain the {@link
129 * <tt>formatter</tt> respectively.
161 * formatter class specification.
163 void formatTo(Formatter formatter, int flags, int width, int precision); argument
/libcore/luni/src/test/java/libcore/java/util/logging/
H A DOldXMLFormatterTest.java29 XMLFormatter formatter = null; field in class:OldXMLFormatterTest
35 formatter = new XMLFormatter();
43 String result = formatter.getHead(handler);
55 assertTrue("Tail string position should be more zero", formatter
61 "</log>", formatter.getTail(null).trim());
63 formatter.getTail(handler).trim());
66 "</log>", formatter.getTail(handler).trim());
H A DOldFileHandlerTest.java59 props.put("java.util.logging.FileHandler.formatter", className
341 Formatter formatter) throws Exception {
342 assertFileContent(homepath, filename, new LogRecord[] { r }, formatter);
346 LogRecord[] lr, Formatter formatter) throws Exception {
349 // if formatter is null, the file content should be empty
351 if (null != formatter) {
353 sb.append(formatter.getHead(handler));
361 sb.append(formatter.getTail(handler));
362 sb.append(formatter.getHead(handler));
364 sb.append(formatter
340 assertFileContent(String homepath, String filename, Formatter formatter) argument
345 assertFileContent(String homepath, String filename, LogRecord[] lr, Formatter formatter) argument
[all...]
/libcore/luni/src/main/java/libcore/icu/
H A DDateTimeFormat.java29 * A formatter that outputs a single date/time.
48 DateFormat formatter = CACHED_FORMATTERS.get(key);
49 if (formatter == null) {
51 formatter = new SimpleDateFormat(generator.getBestPattern(skeleton), icuLocale);
52 CACHED_FORMATTERS.put(key, formatter);
54 formatter.setContext(displayContext);
55 return formatter.format(time);
H A DDateIntervalFormat.java86 android.icu.text.DateIntervalFormat formatter =
88 return formatter.format(startCalendar, endCalendar, new StringBuffer(),
96 android.icu.text.DateIntervalFormat formatter = CACHED_FORMATTERS.get(key);
97 if (formatter != null) {
98 return formatter;
100 formatter = android.icu.text.DateIntervalFormat.getInstance(skeleton, locale);
101 formatter.setTimeZone(icuTimeZone);
102 CACHED_FORMATTERS.put(key, formatter);
103 return formatter;
H A DRelativeDateTimeFormatter.java221 android.icu.text.RelativeDateTimeFormatter formatter =
224 return formatter.format(count, direction, unit);
226 return formatter.format(direction, aunit);
332 * should always be used along with the action of the formatter in a
333 * synchronized block, because otherwise the formatter returned by
335 * formatter->action().
341 android.icu.text.RelativeDateTimeFormatter formatter = CACHED_FORMATTERS.get(key);
342 if (formatter == null) {
343 formatter = android.icu.text.RelativeDateTimeFormatter.getInstance(
345 CACHED_FORMATTERS.put(key, formatter);
[all...]
/libcore/ojluni/src/test/java/time/test/java/time/format/
H A DTestDateTimeParsing.java137 public void test_parse_instantZones_ZDT(DateTimeFormatter formatter, String text, ZonedDateTime expected) { argument
138 TemporalAccessor actual = formatter.parse(text);
143 public void test_parse_instantZones_LDT(DateTimeFormatter formatter, String text, ZonedDateTime expected) { argument
144 TemporalAccessor actual = formatter.parse(text);
149 public void test_parse_instantZones_Instant(DateTimeFormatter formatter, String text, ZonedDateTime expected) { argument
150 TemporalAccessor actual = formatter.parse(text);
155 public void test_parse_instantZones_supported(DateTimeFormatter formatter, String text, ZonedDateTime expected) { argument
156 TemporalAccessor actual = formatter.parse(text);
176 public void test_parse_instantNoZone_ZDT(DateTimeFormatter formatter, String text, Instant expected) { argument
177 TemporalAccessor actual = formatter
182 test_parse_instantNoZone_LDT(DateTimeFormatter formatter, String text, Instant expected) argument
188 test_parse_instantNoZone_Instant(DateTimeFormatter formatter, String text, Instant expected) argument
194 test_parse_instantNoZone_supported(DateTimeFormatter formatter, String text, Instant expected) argument
[all...]
/libcore/ojluni/src/test/java/time/tck/java/time/format/
H A DTCKFormatStyle.java112 DateTimeFormatter formatter = builder.appendLocalized(style, style).appendLiteral(" ").appendZoneOrOffsetId().toFormatter();
114 formatter = formatter.withLocale(Locale.UK);
115 assertEquals(formatter.format(temporal), formattedStr);
H A DTCKResolverStyle.java123 DateTimeFormatter formatter = builder.appendOptional(optionalFormatter).toFormatter();
124 formatter = formatter.withResolverStyle(style);
126 TemporalAccessor accessor = formatter.parse(str);
132 formatter.parse(str);
H A DTCKSignStyle.java121 DateTimeFormatter formatter = builder.appendValue(ChronoField.YEAR, 2, 4, style)
123 formatter = formatter.withZone(ZoneOffset.UTC);
125 String output = formatter.format(localDate);
129 formatter.format(localDate);
/libcore/ojluni/src/main/java/java/time/format/
H A DDateTimePrintContext.java103 * The formatter, not null.
105 private DateTimeFormatter formatter; field in class:DateTimePrintContext
107 * Whether the current formatter is optional.
115 * @param formatter the formatter controlling the format, not null
117 DateTimePrintContext(TemporalAccessor temporal, DateTimeFormatter formatter) { argument
119 this.temporal = adjust(temporal, formatter);
120 this.formatter = formatter;
123 private static TemporalAccessor adjust(final TemporalAccessor temporal, DateTimeFormatter formatter) { argument
[all...]
H A DDateTimeParseContext.java95 * The formatter, not null.
97 private DateTimeFormatter formatter; field in class:DateTimeParseContext
118 * @param formatter the formatter controlling the parse, not null
120 DateTimeParseContext(DateTimeFormatter formatter) { argument
122 this.formatter = formatter;
131 DateTimeParseContext newContext = new DateTimeParseContext(formatter);
147 return formatter.getLocale();
158 return formatter
[all...]
H A DDateTimeFormatter.java116 * {@code format(DateTimeFormatter formatter)}, and one for parsing,
117 * {@code parse(CharSequence text, DateTimeFormatter formatter)}.
121 * String text = date.format(formatter);
122 * LocalDate parsedDate = LocalDate.parse(text, formatter);
128 * The {@link #withLocale withLocale} method returns a new formatter that
131 * formatter that uses the locale specific date format.
133 * The {@link #withChronology withChronology} method returns a new formatter
138 * The {@link #withZone withZone} method returns a new formatter that overrides
143 * The {@link #withDecimalStyle withDecimalStyle} method returns a new formatter that
264 * A formatter create
2094 private final DateTimeFormatter formatter; field in class:DateTimeFormatter.ClassicFormat
2098 ClassicFormat(DateTimeFormatter formatter, TemporalQuery<?> parseType) argument
[all...]
/libcore/ojluni/src/main/java/java/util/logging/
H A DHandler.java60 private volatile Formatter formatter; field in class:Handler
125 formatter = newFormatter;
133 return formatter;
H A DStreamHandler.java52 * <li> &lt;handler-name&gt;.formatter
63 * <li> java.util.logging.StreamHandler.formatter=java.util.logging.SimpleFormatter </li>
69 * <li> com.foo.MyHandler.formatter=java.util.logging.SimpleFormatter </li>
89 setFormatter(manager.getFormatterProperty(cname +".formatter", new SimpleFormatter()));
116 * @param formatter Formatter to be used to format output
118 public StreamHandler(OutputStream out, Formatter formatter) { argument
121 setFormatter(formatter);
/libcore/ojluni/src/main/java/java/io/
H A DPrintWriter.java68 private Formatter formatter; field in class:PrintWriter
794 * formatter class specification.
845 * formatter class specification.
902 if ((formatter == null)
903 || (formatter.locale() != Locale.getDefault()))
904 formatter = new Formatter(this);
905 formatter.format(Locale.getDefault(), format, args);
949 * formatter class specification.
962 if ((formatter == null) || (formatter
[all...]
H A DPrintStream.java64 private Formatter formatter; field in class:PrintStream
890 * formatter class specification.
940 * formatter class specification.
983 * formatter class specification.
996 if ((formatter == null)
997 || (formatter.locale() != Locale.getDefault()))
998 formatter = new Formatter((Appendable) this);
999 formatter.format(Locale.getDefault(), format, args);
1040 * formatter class specification.
1053 if ((formatter
[all...]
/libcore/luni/src/test/java/libcore/java/util/
H A DOldFormatterTest.java32 public void formatTo(Formatter formatter, int flags, int width, int precision) throws IllegalFormatException {
34 formatter.out().append("111");
41 public void formatTo(Formatter formatter, int flags, int width, int precision) throws IllegalFormatException {
43 formatter.out().append("222");
/libcore/ojluni/src/main/java/java/time/
H A DMonthDay.java292 * Obtains an instance of {@code MonthDay} from a text string using a specific formatter.
294 * The text is parsed using the formatter, returning a month-day.
297 * @param formatter the formatter to use, not null
301 public static MonthDay parse(CharSequence text, DateTimeFormatter formatter) { argument
302 Objects.requireNonNull(formatter, "formatter");
303 return formatter.parse(text, MonthDay::from);
630 * Formats this month-day using the specified formatter.
632 * This month-day will be passed to the formatter t
638 format(DateTimeFormatter formatter) argument
[all...]
H A DOffsetTime.java310 * Obtains an instance of {@code OffsetTime} from a text string using a specific formatter.
312 * The text is parsed using the formatter, returning a time.
315 * @param formatter the formatter to use, not null
319 public static OffsetTime parse(CharSequence text, DateTimeFormatter formatter) { argument
320 Objects.requireNonNull(formatter, "formatter");
321 return formatter.parse(text, OffsetTime::from);
1190 * Formats this time using the specified formatter.
1192 * This time will be passed to the formatter t
1198 format(DateTimeFormatter formatter) argument
[all...]
H A DYear.java275 * Obtains an instance of {@code Year} from a text string using a specific formatter.
277 * The text is parsed using the formatter, returning a year.
280 * @param formatter the formatter to use, not null
284 public static Year parse(CharSequence text, DateTimeFormatter formatter) { argument
285 Objects.requireNonNull(formatter, "formatter");
286 return formatter.parse(text, Year::from);
924 * Formats this year using the specified formatter.
926 * This year will be passed to the formatter t
932 format(DateTimeFormatter formatter) argument
[all...]
H A DYearMonth.java278 * Obtains an instance of {@code YearMonth} from a text string using a specific formatter.
280 * The text is parsed using the formatter, returning a year-month.
283 * @param formatter the formatter to use, not null
287 public static YearMonth parse(CharSequence text, DateTimeFormatter formatter) { argument
288 Objects.requireNonNull(formatter, "formatter");
289 return formatter.parse(text, YearMonth::from);
1057 * Formats this year-month using the specified formatter.
1059 * This year-month will be passed to the formatter t
1065 format(DateTimeFormatter formatter) argument
[all...]
/libcore/luni/src/test/java/libcore/java/text/
H A DDecimalFormatTest.java181 DecimalFormat formatter = new DecimalFormat();
182 formatter.setDecimalFormatSymbols(decimalFormatSymbols);
183 formatter.applyLocalizedPattern("#.aa");
184 assertEquals("e.fa", formatter.format(4.50));
190 DecimalFormat formatter = new DecimalFormat();
191 formatter.setDecimalFormatSymbols(decimalFormatSymbols);
192 formatter.applyLocalizedPattern("#");
193 assertEquals("eadacab", formatter.format(4030201));

Completed in 305 milliseconds

12