Example usage for java.time Duration multipliedBy

List of usage examples for java.time Duration multipliedBy

Introduction

In this page you can find the example usage for java.time Duration multipliedBy.

Prototype

public Duration multipliedBy(long multiplicand) 

Source Link

Document

Returns a copy of this duration multiplied by the scalar.

Usage

From source file:Main.java

public static void main(String[] args) {
    Duration duration = Duration.between(LocalTime.MIDNIGHT, LocalTime.NOON);
    System.out.println(duration.getSeconds());

    duration = duration.multipliedBy(2);

    System.out.println(duration.getSeconds());

}

From source file:ddf.content.plugin.video.VideoThumbnailPlugin.java

private byte[] createGifThumbnailWithDuration(final String videoFilePath, final Duration duration)
        throws IOException, InterruptedException {
    final Duration durationFraction = duration.dividedBy(THUMBNAIL_COUNT);

    // Start numbering files with 1 to match FFmpeg's convention.
    for (int clipNum = FFMPEG_FILE_NUMBERING_START; clipNum <= THUMBNAIL_COUNT; ++clipNum) {
        final String thumbnailPath = String.format(getThumbnailFilePath(), clipNum);

        final String seek = durationToString(durationFraction.multipliedBy(clipNum - 1));

        final CommandLine command = getFFmpegCreateThumbnailCommand(videoFilePath, thumbnailPath, seek, 1);

        final DefaultExecuteResultHandler resultHandler = executeFFmpeg(command, 15, null);
        resultHandler.waitFor();//from   ww  w.  j  av  a  2 s.  c om
    }

    return createGifFromThumbnailFiles();
}