public int estimateParsedLength() {
return iMaxDigits;
}
public int parseInto(DateTimeParserBucket bucket, String text, int position) {
DateTimeField field = iFieldType.getField(bucket.getChronology());
int limit = Math.min(iMaxDigits, text.length() - position);
long value = 0;
long n = field.getDurationField().getUnitMillis() * 10;
int length = 0;
while (length < limit) {
char c = text.charAt(position + length);
if (c < '0' || c > '9') {
break;
}
length++;
long nn = n / 10;
value += (c - '0') * nn;
n = nn;
}
value /= 10;
if (length == 0) {
return ~position;
}
if (value > Integer.MAX_VALUE) {
return ~position;
}
DateTimeField parseField = new PreciseDateTimeField(
DateTimeFieldType.millisOfSecond(),
MillisDurationField.INSTANCE,
field.getDurationField());
bucket.saveField(parseField, (int) value);