static class PeriodFormatterBuilder.Literal extends java.lang.Object implements PeriodPrinter, PeriodParser
Modifier and Type | Field and Description |
---|---|
(package private) static PeriodFormatterBuilder.Literal |
EMPTY |
private java.lang.String |
iText |
Constructor and Description |
---|
Literal(java.lang.String text) |
Modifier and Type | Method and Description |
---|---|
int |
calculatePrintedLength(ReadablePeriod period,
java.util.Locale locale)
Returns the exact number of characters produced for the given period.
|
int |
countFieldsToPrint(ReadablePeriod period,
int stopAt,
java.util.Locale locale)
Returns the amount of fields from the given period that this printer
will print.
|
int |
parseInto(ReadWritablePeriod period,
java.lang.String periodStr,
int position,
java.util.Locale locale)
Parses a period from the given text, at the given position, saving the
result into the fields of the given ReadWritablePeriod.
|
void |
printTo(java.lang.StringBuffer buf,
ReadablePeriod period,
java.util.Locale locale)
Prints a ReadablePeriod to a StringBuffer.
|
void |
printTo(java.io.Writer out,
ReadablePeriod period,
java.util.Locale locale)
Prints a ReadablePeriod to a Writer.
|
static final PeriodFormatterBuilder.Literal EMPTY
private final java.lang.String iText
public int countFieldsToPrint(ReadablePeriod period, int stopAt, java.util.Locale locale)
PeriodPrinter
countFieldsToPrint
in interface PeriodPrinter
period
- the period to usestopAt
- stop counting at this value, enter a number ≥ 256 to count alllocale
- the locale to usepublic int calculatePrintedLength(ReadablePeriod period, java.util.Locale locale)
PeriodPrinter
calculatePrintedLength
in interface PeriodPrinter
period
- the period to uselocale
- the locale to usepublic void printTo(java.lang.StringBuffer buf, ReadablePeriod period, java.util.Locale locale)
PeriodPrinter
printTo
in interface PeriodPrinter
buf
- the formatted period is appended to this bufferperiod
- the period to formatlocale
- the locale to usepublic void printTo(java.io.Writer out, ReadablePeriod period, java.util.Locale locale) throws java.io.IOException
PeriodPrinter
printTo
in interface PeriodPrinter
out
- the formatted period is written outperiod
- the period to formatlocale
- the locale to usejava.io.IOException
public int parseInto(ReadWritablePeriod period, java.lang.String periodStr, int position, java.util.Locale locale)
PeriodParser
If it fails, the return value is negative, but the period may still be modified. To determine the position where the parse failed, apply the one's complement operator (~) on the return value.
parseInto
in interface PeriodParser
period
- a period that will be modifiedperiodStr
- text to parseposition
- position to start parsing fromlocale
- the locale to use for parsing