nl.vpro.api.rs.subtitles.VTTReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of subtitles-domain Show documentation
Show all versions of subtitles-domain Show documentation
Subtitles are related to media, but are implemented completely parallel. Classes to contain, parse, and assemble subtitle objects are here.
The newest version!
package nl.vpro.api.rs.subtitles;
import java.io.InputStream;
import java.util.Iterator;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.ext.Provider;
import nl.vpro.domain.subtitles.Cue;
import nl.vpro.domain.subtitles.WEBVTTandSRT;
/**
* @author Michiel Meeuwissen
* @since 4.8
*/
@Provider
@Consumes(Constants.VTT)
public class VTTReader extends AbstractIteratorReader {
public VTTReader() {
super(Constants.VTT_TYPE);
}
@Override
protected Iterator read(InputStream entityStream) {
return WEBVTTandSRT.parseWEBVTT(null, entityStream).getCues().iterator();
}
}