Home
last modified time | relevance | path

Searched refs:formatter (Results 1 – 25 of 53) sorted by relevance

123

/libcore/luni/src/test/java/libcore/java/time/format/
DDateTimeFormatterBuilderTest.java46 DateTimeFormatter formatter = new DateTimeFormatterBuilder() in test_append_DateTimeFormatter() local
49 assertEquals("<2000-12-31>", formatter.format(LocalDate.of(2000, Month.DECEMBER, 31))); in test_append_DateTimeFormatter()
54 DateTimeFormatter formatter = in test_appendZoneRegionId_format() local
58 formatter.format(ZonedDateTime.now(ZoneId.of("Europe/London")))); in test_appendZoneRegionId_format()
60 formatter.format(ZonedDateTime.now(ZoneId.of("UTC")))); in test_appendZoneRegionId_format()
65 DateTimeFormatter formatter = in test_appendZoneRegionId_format_offset() local
69 formatter.format(OffsetDateTime.now(ZoneOffset.UTC)); in test_appendZoneRegionId_format_offset()
77 DateTimeFormatter formatter = new DateTimeFormatterBuilder().appendZoneRegionId() in test_appendZoneRegionId_parse() local
81 formatter.parse("Europe/London").query(TemporalQueries.zoneId())); in test_appendZoneRegionId_parse()
83 formatter.parse("UTC").query(TemporalQueries.zoneId())); in test_appendZoneRegionId_parse()
[all …]
DDateTimeFormatterTest.java69 for (DateTimeFormatter formatter : formatters) { in test_getDecimalStyle()
71 assertEquals(formatter.toString(), DecimalStyle.STANDARD, formatter.getDecimalStyle()); in test_getDecimalStyle()
73 DateTimeFormatter arStyleFormatter = formatter.withDecimalStyle(arDecimalStyle); in test_getDecimalStyle()
78 assertEquals(formatter.toString(), DecimalStyle.STANDARD, formatter.getDecimalStyle()); in test_getDecimalStyle()
/libcore/luni/src/test/java/libcore/java/util/logging/
DOldXMLFormatterTest.java29 XMLFormatter formatter = null; field in OldXMLFormatterTest
35 formatter = new XMLFormatter(); in setUp()
43 String result = formatter.getHead(handler); in testXMLFormatter()
55 assertTrue("Tail string position should be more zero", formatter in testXMLFormatter()
61 "</log>", formatter.getTail(null).trim()); in testGetTail()
63 formatter.getTail(handler).trim()); in testGetTail()
66 "</log>", formatter.getTail(handler).trim()); in testGetTail()
DOldFileHandlerTest.java341 Formatter formatter) throws Exception { in assertFileContent() argument
342 assertFileContent(homepath, filename, new LogRecord[] { r }, formatter); in assertFileContent()
346 LogRecord[] lr, Formatter formatter) throws Exception { in assertFileContent() argument
351 if (null != formatter) { in assertFileContent()
353 sb.append(formatter.getHead(handler)); in assertFileContent()
361 sb.append(formatter.getTail(handler)); in assertFileContent()
362 sb.append(formatter.getHead(handler)); in assertFileContent()
364 sb.append(formatter.format(lr[i])); in assertFileContent()
367 sb.append(formatter.getTail(handler)); in assertFileContent()
/libcore/ojluni/src/test/java/time/test/java/time/format/
DTestDateTimeParsing.java152 …public void test_parse_instantZones_ZDT(DateTimeFormatter formatter, String text, ZonedDateTime ex… in test_parse_instantZones_ZDT() argument
153 TemporalAccessor actual = formatter.parse(text); in test_parse_instantZones_ZDT()
158 …public void test_parse_instantZones_LDT(DateTimeFormatter formatter, String text, ZonedDateTime ex… in test_parse_instantZones_LDT() argument
159 TemporalAccessor actual = formatter.parse(text); in test_parse_instantZones_LDT()
164 …public void test_parse_instantZones_Instant(DateTimeFormatter formatter, String text, ZonedDateTim… in test_parse_instantZones_Instant() argument
165 TemporalAccessor actual = formatter.parse(text); in test_parse_instantZones_Instant()
170 …public void test_parse_instantZones_supported(DateTimeFormatter formatter, String text, ZonedDateT… in test_parse_instantZones_supported() argument
171 TemporalAccessor actual = formatter.parse(text); in test_parse_instantZones_supported()
191 …public void test_parse_instantNoZone_ZDT(DateTimeFormatter formatter, String text, Instant expecte… in test_parse_instantNoZone_ZDT() argument
192 TemporalAccessor actual = formatter.parse(text); in test_parse_instantNoZone_ZDT()
[all …]
DTestTextParserWithLocale.java117 DateTimeFormatter formatter = getPatternFormatter(pattern).withLocale(locale); in test_parseDayOfWeekText() local
119 assertEquals(DayOfWeek.from(formatter.parse(input, pos)), expected); in test_parseDayOfWeekText()
152 DateTimeFormatter formatter = getFormatter(field, style).withLocale(locale); in test_parseStandaloneText() local
154 assertEquals(formatter.parseUnresolved(input, pos).getLong(field), (long) expectedValue); in test_parseStandaloneText()
183 DateTimeFormatter formatter = getFormatter(field).withLocale(locale); in test_parseLenientText() local
184 assertEquals(formatter.parseUnresolved(input, pos).getLong(field), (long) expectedValue); in test_parseLenientText()
/libcore/ojluni/src/main/java/java/time/format/
DDateTimePrintContext.java105 private DateTimeFormatter formatter; field in DateTimePrintContext
117 DateTimePrintContext(TemporalAccessor temporal, DateTimeFormatter formatter) { in DateTimePrintContext() argument
119 this.temporal = adjust(temporal, formatter); in DateTimePrintContext()
120 this.formatter = formatter; in DateTimePrintContext()
123 …vate static TemporalAccessor adjust(final TemporalAccessor temporal, DateTimeFormatter formatter) { in adjust() argument
125 Chronology overrideChrono = formatter.getChronology(); in adjust()
126 ZoneId overrideZone = formatter.getZone(); in adjust()
250 return formatter.getLocale();
261 return formatter.getDecimalStyle();
DDateTimeParseContext.java97 private DateTimeFormatter formatter; field in DateTimeParseContext
120 DateTimeParseContext(DateTimeFormatter formatter) { in DateTimeParseContext() argument
122 this.formatter = formatter; in DateTimeParseContext()
131 DateTimeParseContext newContext = new DateTimeParseContext(formatter); in copy()
147 return formatter.getLocale(); in getLocale()
158 return formatter.getDecimalStyle(); in getDecimalStyle()
169 chrono = formatter.getChronology(); in getEffectiveChronology()
330 parsed.zone = (parsed.zone != null ? parsed.zone : formatter.getZone()); in toResolved()
DDateTimeFormatter.java2195 private final DateTimeFormatter formatter; field in DateTimeFormatter.ClassicFormat
2199 public ClassicFormat(DateTimeFormatter formatter, TemporalQuery<?> parseType) { in ClassicFormat() argument
2200 this.formatter = formatter; in ClassicFormat()
2215 formatter.formatTo((TemporalAccessor) obj, toAppendTo); in format()
2226 return formatter.parseResolved0(text, null); in parseObject()
2228 return formatter.parse(text, parseType); in parseObject()
2240 context = formatter.parseUnresolved0(text, pos); in parseObject()
2254 … TemporalAccessor resolved = context.toResolved(formatter.resolverStyle, formatter.resolverFields); in parseObject()
/libcore/ojluni/src/test/java/time/tck/java/time/format/
DTCKLocalizedOffsetIdPrinterParser.java39 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.S O") in test_localized_offset_parse() local
41 String date = formatter.format(ZonedDateTime.now(ZoneOffset.UTC)); in test_localized_offset_parse()
42 formatter.parse(date) ; in test_localized_offset_parse()
DTCKResolverStyle.java123 DateTimeFormatter formatter = builder.appendOptional(optionalFormatter).toFormatter(); in test_resolverStyle() local
124 formatter = formatter.withResolverStyle(style); in test_resolverStyle()
126 TemporalAccessor accessor = formatter.parse(str); in test_resolverStyle()
132 formatter.parse(str); in test_resolverStyle()
DTCKSignStyle.java121 DateTimeFormatter formatter = builder.appendValue(ChronoField.YEAR, 2, 4, style) in test_signStyle() local
123 formatter = formatter.withZone(ZoneOffset.UTC); in test_signStyle()
125 String output = formatter.format(localDate); in test_signStyle()
129 formatter.format(localDate); in test_signStyle()
DTCKFormatStyle.java119 …DateTimeFormatter formatter = builder.appendLocalized(style, style).appendLiteral(" ").appendZoneO… in test_formatStyle() local
121 formatter = formatter.withLocale(Locale.UK); in test_formatStyle()
122 assertEquals(formatter.format(temporal), formattedStr); in test_formatStyle()
/libcore/ojluni/src/main/java/java/io/
DPrintWriter.java73 private Formatter formatter; field in PrintWriter
989 if ((formatter == null) in format()
990 || (formatter.locale() != Locale.getDefault())) in format()
991 formatter = new Formatter(this); in format()
992 formatter.format(Locale.getDefault(), format, args); in format()
1049 if ((formatter == null) || (formatter.locale() != l)) in format()
1050 formatter = new Formatter(this, l); in format()
1051 formatter.format(l, format, args); in format()
DPrintStream.java70 private Formatter formatter; field in PrintStream
1236 if ((formatter == null) in format()
1237 || (formatter.locale() != in format()
1239 formatter = new Formatter((Appendable) this); in format()
1240 formatter.format(Locale.getDefault(Locale.Category.FORMAT), in format()
1295 if ((formatter == null) in format()
1296 || (formatter.locale() != l)) in format()
1297 formatter = new Formatter(this, l); in format()
1298 formatter.format(l, format, args); in format()
/libcore/luni/src/test/java/libcore/java/util/
DFormatterTest.java272 Formatter formatter = new Formatter(localeWithoutGrouping); in testGroupingSizeZero() local
273 formatter.format("%,d", 123456789); in testGroupingSizeZero()
295 var formatter = new Formatter(os, UTF_8, (Locale) null); in testConstructor_Ljava_io_OutputStreamLjava_nio_charset_CharsetLjava_util_Locale() local
296 assertNull(formatter.locale()); in testConstructor_Ljava_io_OutputStreamLjava_nio_charset_CharsetLjava_util_Locale()
301 var formatter = new Formatter(os, UTF_8, locale); in testConstructor_Ljava_io_OutputStreamLjava_nio_charset_CharsetLjava_util_Locale() local
302 assertEquals(locale, formatter.locale()); in testConstructor_Ljava_io_OutputStreamLjava_nio_charset_CharsetLjava_util_Locale()
323 var formatter = new Formatter(aFile, UTF_8, (Locale) null); in testConstructor_Ljava_io_FileLjava_nio_charset_CharsetLjava_util_Locale() local
324 assertNull(formatter.locale()); in testConstructor_Ljava_io_FileLjava_nio_charset_CharsetLjava_util_Locale()
327 formatter = new Formatter(aFile, UTF_8, locale); in testConstructor_Ljava_io_FileLjava_nio_charset_CharsetLjava_util_Locale()
328 assertEquals(locale, formatter.locale()); in testConstructor_Ljava_io_FileLjava_nio_charset_CharsetLjava_util_Locale()
[all …]
DOldFormatterTest.java32 …public void formatTo(Formatter formatter, int flags, int width, int precision) throws IllegalForma… in test_Formattable()
34 formatter.out().append("111"); in test_Formattable()
41 …public void formatTo(Formatter formatter, int flags, int width, int precision) throws IllegalForma… in test_Formattable()
43 formatter.out().append("222"); in test_Formattable()
/libcore/luni/src/main/java/libcore/icu/
DDateIntervalFormat.java82 Formatter formatter = new Formatter(); in formatDateRange() local
83 m.invoke(null, /*context="*/ null, formatter, startMs, endMs, flags, olsonId); in formatDateRange()
84 return formatter.toString(); in formatDateRange()
/libcore/ojluni/src/main/java/java/util/logging/
DHandler.java60 private volatile Formatter formatter; field in Handler
125 formatter = newFormatter; in setFormatter()
133 return formatter; in getFormatter()
/libcore/ojluni/src/main/java/java/time/
DMonthDay.java302 public static MonthDay parse(CharSequence text, DateTimeFormatter formatter) { in parse() argument
303 Objects.requireNonNull(formatter, "formatter"); in parse()
304 return formatter.parse(text, MonthDay::from); in parse()
639 public String format(DateTimeFormatter formatter) { in format() argument
640 Objects.requireNonNull(formatter, "formatter"); in format()
641 return formatter.format(this); in format()
DYear.java285 public static Year parse(CharSequence text, DateTimeFormatter formatter) { in parse() argument
286 Objects.requireNonNull(formatter, "formatter"); in parse()
287 return formatter.parse(text, Year::from); in parse()
932 public String format(DateTimeFormatter formatter) { in format() argument
933 Objects.requireNonNull(formatter, "formatter"); in format()
934 return formatter.format(this); in format()
DYearMonth.java288 public static YearMonth parse(CharSequence text, DateTimeFormatter formatter) { in parse() argument
289 Objects.requireNonNull(formatter, "formatter"); in parse()
290 return formatter.parse(text, YearMonth::from); in parse()
1065 public String format(DateTimeFormatter formatter) { in format() argument
1066 Objects.requireNonNull(formatter, "formatter"); in format()
1067 return formatter.format(this); in format()
/libcore/luni/src/test/java/libcore/java/time/chrono/
DJapaneseChronologyTest.java122 DateTimeFormatter formatter = DateTimeFormatter in test_JapaneseEras_dateTimeFormatter() local
128 assertEquals("平成30年1月1日月曜日", heisei.format(formatter.withLocale(ja))); in test_JapaneseEras_dateTimeFormatter()
130 heisei.format(formatter.withLocale(Locale.ENGLISH))); in test_JapaneseEras_dateTimeFormatter()
133 assertEquals("令和1年5月1日水曜日", reiwa.format(formatter.withLocale(ja))); in test_JapaneseEras_dateTimeFormatter()
135 reiwa.format(formatter.withLocale(Locale.ENGLISH))); in test_JapaneseEras_dateTimeFormatter()
/libcore/ojluni/src/main/java/java/lang/runtime/
DObjectMethods.java282 MethodHandle formatter = MethodHandles.insertArguments(STRING_FORMAT, 0, formatString) in makeToString() local
286 formatter = MethodHandles.dropArguments(formatter, 0, receiverClass); in makeToString()
289 MethodHandle filtered = MethodHandles.filterArguments(formatter, 0, filters); in makeToString()
290formatter = MethodHandles.permuteArguments(filtered, MethodType.methodType(String.class, receiverC… in makeToString()
293 return formatter; in makeToString()
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/
DFormatterTest.java80 public void formatTo(Formatter formatter, int flags, int width, in formatTo() argument
83 formatter.format("CUSTOMIZED FORMAT FUNCTION" + " WIDTH: " in formatTo()
86 formatter.format("customized format function" + " width: " in formatTo()
737 Formatter formatter = new Formatter(Locale.US); in test_formatLjava_lang_String$Ljava_lang_Object_ArgIndex() local
738 formatter.format("%1$s%2$s%3$s%4$s%5$s%6$s%7$s%8$s%9$s%11$s%10$s", "1", in test_formatLjava_lang_String$Ljava_lang_Object_ArgIndex()
740 assertEquals("1234567891110", formatter.toString()); in test_formatLjava_lang_String$Ljava_lang_Object_ArgIndex()
742 formatter = new Formatter(Locale.JAPAN); in test_formatLjava_lang_String$Ljava_lang_Object_ArgIndex()
743 formatter.format("%1$s", "hello"); in test_formatLjava_lang_String$Ljava_lang_Object_ArgIndex()
744 assertEquals("hello", formatter.toString()); in test_formatLjava_lang_String$Ljava_lang_Object_ArgIndex()
747 formatter = new Formatter(Locale.US); in test_formatLjava_lang_String$Ljava_lang_Object_ArgIndex()
[all …]

123