/** * Converts an integer to a string, prepended with a variable amount of '0' * pad characters, and appends it to the given buffer. * * <p>This method is optimized for converting small values to strings. * * @param buf receives integer converted to a string * @param value value to convert to a string * @param size minimum amount of digits to append */ public static void appendPaddedInteger(StringBuffer buf, int value, int size) { try { appendPaddedInteger((Appendable)buf, value, size); } catch (IOException e) { // StringBuffer does not throw IOException } }
/** * Converts an integer to a string, prepended with a variable amount of '0' * pad characters, and appends it to the given buffer. * * <p>This method is optimized for converting small values to strings. * * @param buf receives integer converted to a string * @param value value to convert to a string * @param size minimum amount of digits to append */ public static void appendPaddedInteger(StringBuffer buf, long value, int size) { try { appendPaddedInteger((Appendable)buf, value, size); } catch (IOException e) { // StringBuffer does not throw IOException } }
/** * Converts an integer to a string, prepended with a variable amount of '0' * pad characters, and appends it to the given buffer. * * <p>This method is optimized for converting small values to strings. * * @param buf receives integer converted to a string * @param value value to convert to a string * @param size minimum amount of digits to append */ public static void appendPaddedInteger(StringBuffer buf, long value, int size) { try { appendPaddedInteger((Appendable)buf, value, size); } catch (IOException e) { // StringBuffer does not throw IOException } }
/** * Converts an integer to a string, prepended with a variable amount of '0' * pad characters, and appends it to the given buffer. * * <p>This method is optimized for converting small values to strings. * * @param buf receives integer converted to a string * @param value value to convert to a string * @param size minimum amount of digits to append */ public static void appendPaddedInteger(StringBuffer buf, int value, int size) { try { appendPaddedInteger((Appendable)buf, value, size); } catch (IOException e) { // StringBuffer does not throw IOException } }
public void printTo( Appendable appendable, long instant, Chronology chrono, int displayOffset, DateTimeZone displayZone, Locale locale) throws IOException { int year = getTwoDigitYear(instant, chrono); if (year < 0) { appendable.append('\ufffd'); appendable.append('\ufffd'); } else { FormatUtils.appendPaddedInteger(appendable, year, 2); } }
public void printTo(Appendable appendable, ReadablePartial partial, Locale locale) throws IOException { int year = getTwoDigitYear(partial); if (year < 0) { appendable.append('\ufffd'); appendable.append('\ufffd'); } else { FormatUtils.appendPaddedInteger(appendable, year, 2); } }
public void printTo( Appendable appendable, long instant, Chronology chrono, int displayOffset, DateTimeZone displayZone, Locale locale) throws IOException { int year = getTwoDigitYear(instant, chrono); if (year < 0) { appendable.append('\ufffd'); appendable.append('\ufffd'); } else { FormatUtils.appendPaddedInteger(appendable, year, 2); } }
public void printTo(Appendable appendable, ReadablePartial partial, Locale locale) throws IOException { int year = getTwoDigitYear(partial); if (year < 0) { appendable.append('\ufffd'); appendable.append('\ufffd'); } else { FormatUtils.appendPaddedInteger(appendable, year, 2); } }
FormatUtils.appendPaddedInteger(buf, hours, 2); offset -= hours * (int) DateTimeConstants.MILLIS_PER_HOUR; FormatUtils.appendPaddedInteger(buf, minutes, 2); offset -= minutes * DateTimeConstants.MILLIS_PER_MINUTE; if (offset == 0) { FormatUtils.appendPaddedInteger(buf, seconds, 2); offset -= seconds * DateTimeConstants.MILLIS_PER_SECOND; if (offset == 0) { FormatUtils.appendPaddedInteger(buf, offset, 3); return buf.toString();
FormatUtils.appendPaddedInteger(buf, hours, 2); if (iMaxFields == 1) { return; buf.append(':'); FormatUtils.appendPaddedInteger(buf, minutes, 2); if (iMaxFields == 2) { return; buf.append(':'); FormatUtils.appendPaddedInteger(buf, seconds, 2); if (iMaxFields == 3) { return; buf.append('.'); FormatUtils.appendPaddedInteger(buf, displayOffset, 3);
FormatUtils.appendPaddedInteger(buf, hours, 2); offset -= hours * (int) DateTimeConstants.MILLIS_PER_HOUR; FormatUtils.appendPaddedInteger(buf, minutes, 2); offset -= minutes * DateTimeConstants.MILLIS_PER_MINUTE; if (offset == 0) { FormatUtils.appendPaddedInteger(buf, seconds, 2); offset -= seconds * DateTimeConstants.MILLIS_PER_SECOND; if (offset == 0) { FormatUtils.appendPaddedInteger(buf, offset, 3); return buf.toString();
FormatUtils.appendPaddedInteger(buf, hours, 2); if (iMaxFields == 1) { return; buf.append(':'); FormatUtils.appendPaddedInteger(buf, minutes, 2); if (iMaxFields == 2) { return; buf.append(':'); FormatUtils.appendPaddedInteger(buf, seconds, 2); if (iMaxFields == 3) { return; buf.append('.'); FormatUtils.appendPaddedInteger(buf, displayOffset, 3);
int intValue = (int)value; if (intValue == value) { appendPaddedInteger(appendable, intValue, size); } else if (size <= 19) { appendable.append(Long.toString(value));
int intValue = (int)value; if (intValue == value) { appendPaddedInteger(appendable, intValue, size); } else if (size <= 19) { appendable.append(Long.toString(value));
FormatUtils.appendUnpaddedInteger(buf, value); } else { FormatUtils.appendPaddedInteger(buf, value, minDigits); FormatUtils.appendPaddedInteger(buf, dp, 3);
FormatUtils.appendUnpaddedInteger(buf, value); } else { FormatUtils.appendPaddedInteger(buf, value, minDigits); FormatUtils.appendPaddedInteger(buf, dp, 3);
public void printTo( Appendable appendable, long instant, Chronology chrono, int displayOffset, DateTimeZone displayZone, Locale locale) throws IOException { try { DateTimeField field = iFieldType.getField(chrono); FormatUtils.appendPaddedInteger(appendable, field.get(instant), iMinPrintedDigits); } catch (RuntimeException e) { appendUnknownString(appendable, iMinPrintedDigits); } }
public void printTo( Appendable appendable, long instant, Chronology chrono, int displayOffset, DateTimeZone displayZone, Locale locale) throws IOException { try { DateTimeField field = iFieldType.getField(chrono); FormatUtils.appendPaddedInteger(appendable, field.get(instant), iMinPrintedDigits); } catch (RuntimeException e) { appendUnknownString(appendable, iMinPrintedDigits); } }
public void printTo(Appendable appendable, ReadablePartial partial, Locale locale) throws IOException { if (partial.isSupported(iFieldType)) { try { FormatUtils.appendPaddedInteger(appendable, partial.get(iFieldType), iMinPrintedDigits); } catch (RuntimeException e) { appendUnknownString(appendable, iMinPrintedDigits); } } else { appendUnknownString(appendable, iMinPrintedDigits); } } }
public void printTo(Appendable appendable, ReadablePartial partial, Locale locale) throws IOException { if (partial.isSupported(iFieldType)) { try { FormatUtils.appendPaddedInteger(appendable, partial.get(iFieldType), iMinPrintedDigits); } catch (RuntimeException e) { appendUnknownString(appendable, iMinPrintedDigits); } } else { appendUnknownString(appendable, iMinPrintedDigits); } } }