Class ChecksumEventStream
java.lang.Object
opennlp.tools.util.AbstractObjectStream<opennlp.tools.ml.model.Event>
opennlp.tools.ml.model.ChecksumEventStream
- All Implemented Interfaces:
AutoCloseable, opennlp.tools.util.ObjectStream<opennlp.tools.ml.model.Event>
public class ChecksumEventStream
extends opennlp.tools.util.AbstractObjectStream<opennlp.tools.ml.model.Event>
A
Checksum-based event stream implementation.
Computes the checksum while consuming the event stream.
By default, this implementation will use CRC32C for checksum calculations
as it can use of CPU-specific acceleration instructions at runtime.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionChecksumEventStream(opennlp.tools.util.ObjectStream<opennlp.tools.ml.model.Event> eventStream) Initializes anChecksumEventStream. -
Method Summary
Modifier and TypeMethodDescriptionlongCalculates and returns the (current) checksum.opennlp.tools.ml.model.Eventread()Methods inherited from class opennlp.tools.util.AbstractObjectStream
close, reset
-
Constructor Details
-
ChecksumEventStream
public ChecksumEventStream(opennlp.tools.util.ObjectStream<opennlp.tools.ml.model.Event> eventStream) Initializes anChecksumEventStream.- Parameters:
eventStream- TheObjectStreamthat provides theEventsamples.
-
-
Method Details
-
read
- Specified by:
readin interfaceopennlp.tools.util.ObjectStream<opennlp.tools.ml.model.Event>- Overrides:
readin classopennlp.tools.util.AbstractObjectStream<opennlp.tools.ml.model.Event>- Throws:
IOException
-
calculateChecksum
public long calculateChecksum()Calculates and returns the (current) checksum.Note: This should be called once the underlying stream has been (fully) consumed.
- Returns:
- The calculated checksum as
long.
-