Package org.joda.time.format
Interface InternalParser
- All Known Implementing Classes:
DateTimeFormat.StyleFormatter,DateTimeFormatterBuilder.CharacterLiteral,DateTimeFormatterBuilder.Composite,DateTimeFormatterBuilder.FixedNumber,DateTimeFormatterBuilder.Fraction,DateTimeFormatterBuilder.MatchingParser,DateTimeFormatterBuilder.NumberFormatter,DateTimeFormatterBuilder.PaddedNumber,DateTimeFormatterBuilder.StringLiteral,DateTimeFormatterBuilder.TextField,DateTimeFormatterBuilder.TimeZoneId,DateTimeFormatterBuilder.TimeZoneName,DateTimeFormatterBuilder.TimeZoneOffset,DateTimeFormatterBuilder.TwoDigitYear,DateTimeFormatterBuilder.UnpaddedNumber,DateTimeParserInternalParser,InternalParserDateTimeParser
interface InternalParser
Internal interface for parsing textual representations of datetimes.
This has been separated from DateTimeParser to change to using
CharSequence.
- Since:
- 2.4
-
Method Summary
Modifier and TypeMethodDescriptionintReturns the expected maximum number of characters consumed.intparseInto(DateTimeParserBucket bucket, CharSequence text, int position) Parse an element from the given text, saving any fields into the given DateTimeParserBucket.
-
Method Details
-
estimateParsedLength
int estimateParsedLength()Returns the expected maximum number of characters consumed. The actual amount should rarely exceed this estimate.- Returns:
- the estimated length
-
parseInto
Parse an element from the given text, saving any fields into the given DateTimeParserBucket. If the parse succeeds, the return value is the new text position. Note that the parse may succeed without fully reading the text.If it fails, the return value is negative. To determine the position where the parse failed, apply the one's complement operator (~) on the return value.
- Parameters:
bucket- field are saved into this, not nulltext- the text to parse, not nullposition- position to start parsing from- Returns:
- new position, negative value means parse failed - apply complement operator (~) to get position of failure
- Throws:
IllegalArgumentException- if any field is out of range
-