com.github.alexeylapin.m3u8.parser.PartialSegmentInformationAttribute Maven / Gradle / Ivy
The newest version!
package com.github.alexeylapin.m3u8.parser;
import com.github.alexeylapin.m3u8.model.PartialSegmentInformation;
import com.github.alexeylapin.m3u8.model.PartialSegment;
import com.github.alexeylapin.m3u8.model.PartialSegmentInformation;
import java.util.Map;
public enum PartialSegmentInformationAttribute implements Attribute {
PART_TARGET {
@Override
public void read(PartialSegmentInformation.Builder builder, String value) throws PlaylistParserException {
builder.partTargetDuration(Double.parseDouble(value));
}
@Override
public void write(PartialSegmentInformation value, TextBuilder textBuilder) {
textBuilder.add(key(), value.partTargetDuration());
}
};
final static Map attributeMap = ParserUtils.toMap(values(), Attribute::key);
static PartialSegmentInformation parse(String attributes, ParsingMode parsingMode) throws PlaylistParserException {
PartialSegmentInformation.Builder builder = PartialSegmentInformation.builder();
ParserUtils.readAttributes(attributeMap, attributes, builder, parsingMode);
return builder.build();
}
}