public abstract class AisPacketStream extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
AisPacketStream.StreamConsumer<T>
The type Stream consumer.
|
static interface |
AisPacketStream.Subscription
A subcription is created each time a new consumer is added to the stream.
|
| Modifier and Type | Field and Description |
|---|---|
static RuntimeException |
CANCEL
Thrown by a subscriber to indicate that the subscription should be cancelled.
|
| Constructor and Description |
|---|
AisPacketStream() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(AisPacket p)
Adds the specified packet to the stream
|
abstract AisPacketStream |
filter(Predicate<? super AisPacket> predicate)
Returns a new stream that only streams packets accepted by the specified predicate.
|
AisPacketStream |
filter(String expression)
Filter ais packet stream.
|
AisPacketStream |
filterOnMessageType(int... messageTypes)
Filter on message type ais packet stream.
|
AisPacketStream |
immutableStream()
Immutable stream ais packet stream.
|
AisPacketStream |
limit(long limit)
Limit ais packet stream.
|
static AisPacketStream |
newStream()
Returns a new stream.
|
abstract AisPacketStream.Subscription |
subscribe(Consumer<AisPacket> c)
Subscribe subscription.
|
AisPacketStream.Subscription |
subscribeMessages(Consumer<AisMessage> c)
Subscribe messages subscription.
|
AisPacketStream.Subscription |
subscribeSink(dk.dma.commons.util.io.OutputStreamSink<AisPacket> sink,
OutputStream os)
Subscribe sink subscription.
|
public static final RuntimeException CANCEL
public void add(AisPacket p)
p - the pUnsupportedOperationException - if the stream is immutablepublic abstract AisPacketStream filter(Predicate<? super AisPacket> predicate)
predicate - the predicate to test against each elementpublic AisPacketStream filter(String expression)
expression - the expressionpublic AisPacketStream filterOnMessageType(int... messageTypes)
messageTypes - the message typespublic final AisPacketStream immutableStream()
public AisPacketStream limit(long limit)
limit - the limitpublic abstract AisPacketStream.Subscription subscribe(Consumer<AisPacket> c)
c - the cpublic AisPacketStream.Subscription subscribeMessages(Consumer<AisMessage> c)
c - the cpublic AisPacketStream.Subscription subscribeSink(dk.dma.commons.util.io.OutputStreamSink<AisPacket> sink, OutputStream os)
sink - the sinkos - the ospublic static AisPacketStream newStream()
Copyright © 2011–2019 Danish Maritime Authority. All rights reserved.