public final class WebvttParserUtil extends Object
Modifier and Type | Method and Description |
---|---|
static float |
parsePercentage(String s)
Parses a percentage and returns a scaled float.
|
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 ParserException
input
- The input from which the line should be read.ParserException
- 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
- contains the number to parse.NumberFormatException
- if the number format is invalid or does not end with '%'.