com.kolibrifx.plovercrest.server.internal.folds.PeekableInputStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plovercrest-server Show documentation
Show all versions of plovercrest-server Show documentation
Plovercrest server library.
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 com.kolibrifx.plovercrest.server.streams.StreamDataTriggerer;
public interface PeekableInputStream {
boolean hasNext();
long nextTimestamp();
void consumeNext(FoldCallback super T> cb);
/**
* Conditionally registerer the given (one-off) data triggerer. This will only be done if:
*
* - There is no unconsumed element buffered up.
*
- The last poll operation (triggered by hasNext()) failed; in order words, the underlying
* stream reached the end.
*
* If these conditions are not met, calling this function is a no-op. This makes it safe to call
* this function for each {@link PeekableInputStream} in a fold: it will only be activated for
* those that actually lack data.
*
*
* @return true
if the the triggerer was registered, or possibly invoked inline,
* false
otherwise.
*/
boolean registerDataTriggererIfReachedEnd(StreamDataTriggerer dataTriggerer);
}