private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); initializePattern(isDateIntervalInfoDefault ? LOCAL_PATTERN_CACHE : null); }
/** * Set the date time interval patterns. * @param newItvPattern the given interval patterns to copy. * @stable ICU 4.0 */ public void setDateIntervalInfo(DateIntervalInfo newItvPattern) { // clone it. If it is frozen, the clone returns itself. // Otherwise, clone returns a copy fInfo = (DateIntervalInfo)newItvPattern.clone(); this.isDateIntervalInfoDefault = false; fInfo.freeze(); // freeze it if ( fDateFormat != null ) { initializePattern(null); } }
/** * Construct a DateIntervalFormat from DateFormat, * a DateIntervalInfo, and skeleton. * DateFormat provides the timezone, calendar, * full pattern, and date format symbols information. * It should be a SimpleDateFormat object which * has a pattern in it. * the DateIntervalInfo provides the interval patterns. * * @param skeleton the skeleton of the date formatter * @param dtItvInfo the DateIntervalInfo object to be adopted. * @param simpleDateFormat will be used for formatting * * @internal * @deprecated This API is ICU internal only. */ @Deprecated public DateIntervalFormat(String skeleton, DateIntervalInfo dtItvInfo, SimpleDateFormat simpleDateFormat) { fDateFormat = simpleDateFormat; // freeze date interval info dtItvInfo.freeze(); fSkeleton = skeleton; fInfo = dtItvInfo; isDateIntervalInfoDefault = false; fFromCalendar = (Calendar) fDateFormat.getCalendar().clone(); fToCalendar = (Calendar) fDateFormat.getCalendar().clone(); initializePattern(null); }
private DateIntervalFormat(String skeleton, ULocale locale, SimpleDateFormat simpleDateFormat) { fDateFormat = simpleDateFormat; fSkeleton = skeleton; fInfo = new DateIntervalInfo(locale).freeze(); isDateIntervalInfoDefault = true; fFromCalendar = (Calendar) fDateFormat.getCalendar().clone(); fToCalendar = (Calendar) fDateFormat.getCalendar().clone(); initializePattern(LOCAL_PATTERN_CACHE); }