@Implementation(maxSdk = LOLLIPOP_MR1) @SuppressWarnings("JdkObsolete") public static String formatDateInterval(long address, long fromDate, long toDate) { StringBuffer buffer = new StringBuffer(); FieldPosition pos = new FieldPosition(0); INTERVAL_CACHE.get(address).format(new com.ibm.icu.util.DateInterval(fromDate, toDate), buffer, pos); return buffer.toString(); } }
/** * Format an object to produce a string. This method handles Formattable * objects with a DateInterval type. * If a the Formattable object type is not a DateInterval, * IllegalArgumentException is thrown. * * @param obj The object to format. * Must be a DateInterval. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param fieldPosition On input: an alignment field, if desired. * On output: the offsets of the alignment field. * There may be multiple instances of a given field type * in an interval format; in this case the fieldPosition * offsets refer to the first instance. * @return Reference to 'appendTo' parameter. * @throws IllegalArgumentException if the formatted object is not * DateInterval object * @stable ICU 4.0 */ public final StringBuffer format(Object obj, StringBuffer appendTo, FieldPosition fieldPosition) { if ( obj instanceof DateInterval ) { return format( (DateInterval)obj, appendTo, fieldPosition); } else { throw new IllegalArgumentException("Cannot format given Object (" + obj.getClass().getName() + ") as a DateInterval"); } }
@Implementation public static String formatDateInterval(long address, long fromDate, long toDate) { StringBuffer buffer = new StringBuffer(); FieldPosition pos = new FieldPosition(0); INTERVAL_CACHE.get(address).format(new com.ibm.icu.util.DateInterval(fromDate, toDate), buffer, pos); return buffer.toString(); } }
@Implementation public static String formatDateInterval(long address, long fromDate, long toDate) { StringBuffer buffer = new StringBuffer(); FieldPosition pos = new FieldPosition(0); INTERVAL_CACHE.get(address).format(new com.ibm.icu.util.DateInterval(fromDate, toDate), buffer, pos); return buffer.toString(); } }
@Implementation public static String formatDateInterval(long address, long fromDate, long toDate) { StringBuffer buffer = new StringBuffer(); FieldPosition pos = new FieldPosition(0); INTERVAL_CACHE.get(address).format(new com.ibm.icu.util.DateInterval(fromDate, toDate), buffer, pos); return buffer.toString(); } }
@Implementation(maxSdk = LOLLIPOP_MR1) @SuppressWarnings("JdkObsolete") public static String formatDateInterval(long address, long fromDate, long toDate) { StringBuffer buffer = new StringBuffer(); FieldPosition pos = new FieldPosition(0); INTERVAL_CACHE.get(address).format(new com.ibm.icu.util.DateInterval(fromDate, toDate), buffer, pos); return buffer.toString(); } }
/** * Format a DateInterval to produce a string. * * @param dtInterval DateInterval to be formatted. * @param appendTo Output parameter to receive result. * Result is appended to existing contents. * @param fieldPosition On input: an alignment field, if desired. * On output: the offsets of the alignment field. * There may be multiple instances of a given field type * in an interval format; in this case the fieldPosition * offsets refer to the first instance. * @return Reference to 'appendTo' parameter. * @stable ICU 4.0 */ public final synchronized StringBuffer format(DateInterval dtInterval, StringBuffer appendTo, FieldPosition fieldPosition) { fFromCalendar.setTimeInMillis(dtInterval.getFromDate()); fToCalendar.setTimeInMillis(dtInterval.getToDate()); return format(fFromCalendar, fToCalendar, appendTo, fieldPosition); }