Package net.time4j.format
Class TimeSpanFormatter<U,S extends TimeSpan<U>>
java.lang.Object
net.time4j.format.TimeSpanFormatter<U,S>
- Type Parameters:
- U- generic type of time units
- S- generic type of supported timespan
- Direct Known Subclasses:
- Duration.Formatter,- MachineTime.Formatter
Represents a non-localized and user-defined format for timespans based on a pattern containing some standard symbols and literals.
- Since:
- 3.26/4.22
- 
Method SummaryModifier and TypeMethodDescriptionCreates a textual output of given duration.Yields the underlying format pattern.getType()Yields the associated reified unit type.parse(CharSequence text)Equivalent toparse(text, 0).parse(CharSequence text, int offset)Analyzes given text according to format pattern and parses the text to a duration.voidprint(TimeSpan<? super U> duration, Appendable buffer)Creates a textual output of given duration and writes to the buffer.
- 
Method Details- 
getPatternYields the underlying format pattern. - Returns:
- String
 
- 
getTypeYields the associated reified unit type. - Returns:
- Class
 
- 
formatCreates a textual output of given duration. - Parameters:
- duration- duration object
- Returns:
- textual representation of duration
- Throws:
- IllegalArgumentException- if some aspects of duration prevents printing (for example too many nanoseconds)
 
- 
printCreates a textual output of given duration and writes to the buffer. - Parameters:
- duration- duration object
- buffer- I/O-buffer where the result is written to
- Throws:
- IllegalArgumentException- if some aspects of duration prevents printing (for example too many nanoseconds)
- IOException- if writing into buffer fails
 
- 
parseEquivalent to parse(text, 0).- Parameters:
- text- custom textual representation to be parsed
- Returns:
- parsed duration
- Throws:
- ParseException- (for example in case of mixed signs or if trailing unparsed characters exist)
- See Also:
- parse(CharSequence, int)
 
- 
parseAnalyzes given text according to format pattern and parses the text to a duration. - Parameters:
- text- custom textual representation to be parsed
- offset- start position for the parser
- Returns:
- parsed duration
- Throws:
- ParseException- (for example in case of mixed signs or if trailing unparsed characters exist)
 
 
-