public final class WebvttParserUtil extends Object
Modifier and Type | Method and Description |
---|---|
static Matcher |
findNextCueHeader(ParsableByteArray input)
Reads lines up to and including the next WebVTT cue header.
|
static float |
parsePercentage(String s)
Parses a percentage string.
|
static long |
parseTimestampUs(String timestamp)
Parses a WebVTT timestamp.
|
static void |
validateWebvttHeaderLine(ParsableByteArray input)
Reads and validates the first line of a WebVTT file.
|
public static void validateWebvttHeaderLine(ParsableByteArray input) throws SubtitleDecoderException
input
- The input from which the line should be read.SubtitleDecoderException
- If the line isn't the start of a valid WebVTT file.public static long parseTimestampUs(String timestamp) throws NumberFormatException
timestamp
- The timestamp string.NumberFormatException
- If the timestamp could not be parsed.public static float parsePercentage(String s) throws NumberFormatException
s
- The percentage string.NumberFormatException
- If the percentage could not be parsed.public static Matcher findNextCueHeader(ParsableByteArray input)
input
- The input from which lines should be read.Matcher
for the WebVTT cue header, or null if the end of the input was
reached without a cue header being found. In the case that a cue header is found, groups 1,
2 and 3 of the returned matcher contain the start time, end time and settings list.