All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.vpro.api.rs.subtitles.SRTWriter Maven / Gradle / Ivy

Go to download

Subtitles are related to media, but are implemented completely parallel. Classes to contain, parse, and assemble subtitle objects are here.

There is a newer version: 8.3.0
Show newest version
package nl.vpro.api.rs.subtitles;

import java.io.IOException;
import java.io.OutputStream;
import java.util.Iterator;

import javax.ws.rs.Produces;
import javax.ws.rs.ext.Provider;

import nl.vpro.domain.subtitles.Cue;
import nl.vpro.domain.subtitles.SubtitlesFormat;
import nl.vpro.domain.subtitles.SubtitlesUtil;

import static nl.vpro.api.rs.subtitles.Constants.*;

/**
 * @author Michiel Meeuwissen
 * @since 4.8
 */
@Provider
@Produces(SRT)
public class SRTWriter extends AbstractIteratorWriter {

    public SRTWriter() {
        super(SubtitlesFormat.SRT);
    }

    @Override
    protected void stream(Iterator cueIterator, OutputStream entityStream) throws IOException {
        SubtitlesUtil.toSRT(cueIterator, entityStream);

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy