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

com.kolibrifx.plovercrest.server.internal.folds.PeekableInputStreamUtils Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2010-2017, KolibriFX AS. Licensed under the Apache License, version 2.0.
 */

package com.kolibrifx.plovercrest.server.internal.folds;

import java.nio.ByteBuffer;
import com.kolibrifx.plovercrest.server.streams.Stream;

public final class PeekableInputStreamUtils {
    private PeekableInputStreamUtils() {
    }

    @SuppressWarnings("unchecked")
    public static  PeekableInputStream create(final Stream stream, final long fromTimestamp) {
        if (stream.getElementClass() == ByteBuffer.class) {
            return (PeekableInputStream) new ByteArrayPeekableInputStream((Stream) stream, fromTimestamp);
        } else {
            return new DefaultPeekableInputStream<>(stream, fromTimestamp);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy