Package net.dona.doip
Class InDoipMessageImpl
java.lang.Object
net.dona.doip.InDoipMessageImpl
- All Implemented Interfaces:
AutoCloseable
,Iterable<InDoipSegment>
,InDoipMessage
An implementation of
InDoipMessage
which reads a serialized DOIP message from an InputStream
object.-
Constructor Summary
ConstructorsConstructorDescriptionConstructs anInDoipMessage
object using the serialized DOIP message from the suppliedInputStream
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Reads all remaining segments (unless the DOIP message is malformed, in which case it returns immediately).If the DOIP message was malformed, retrieves aBadDoipException
indicating how; otherwise returns null.iterator()
void
setCompleter
(CompletableFuture<?> completer) Sets theCompletableFuture
object of this InDoipMessageImpl object, which will be completed when the message is fully processed.stream()
Returns an stream over elements of typeInDoipSegment
.
-
Constructor Details
-
InDoipMessageImpl
Constructs anInDoipMessage
object using the serialized DOIP message from the suppliedInputStream
.- Parameters:
in
- the input stream from which to read the serialized DOIP message
-
-
Method Details
-
setCompleter
Sets theCompletableFuture
object of this InDoipMessageImpl object, which will be completed when the message is fully processed. It will be completed normally withnull
when all segments are read; it will be completed exceptionally if the DOIP message is malformed.- Parameters:
completer
- the future to complete when the message is fully processed
-
getTerminalException
If the DOIP message was malformed, retrieves aBadDoipException
indicating how; otherwise returns null.- Returns:
- an instance of
BadDoipException
which indicates how the DOIP message was malformed, or null
-
iterator
- Specified by:
iterator
in interfaceIterable<InDoipSegment>
-
close
public void close()Reads all remaining segments (unless the DOIP message is malformed, in which case it returns immediately).- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceInDoipMessage
-
spliterator
- Specified by:
spliterator
in interfaceIterable<InDoipSegment>
-
stream
Description copied from interface:InDoipMessage
Returns an stream over elements of typeInDoipSegment
.- Specified by:
stream
in interfaceInDoipMessage
- Returns:
- a Stream.
-