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 anInDoipMessageobject using the serialized DOIP message from the suppliedInputStream. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Reads all remaining segments (unless the DOIP message is malformed, in which case it returns immediately).If the DOIP message was malformed, retrieves aBadDoipExceptionindicating how; otherwise returns null.iterator()voidsetCompleter(CompletableFuture<?> completer) Sets theCompletableFutureobject 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 anInDoipMessageobject 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 theCompletableFutureobject of this InDoipMessageImpl object, which will be completed when the message is fully processed. It will be completed normally withnullwhen 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 aBadDoipExceptionindicating how; otherwise returns null.- Returns:
- an instance of
BadDoipExceptionwhich indicates how the DOIP message was malformed, or null
-
iterator
- Specified by:
iteratorin interfaceIterable<InDoipSegment>
-
close
public void close()Reads all remaining segments (unless the DOIP message is malformed, in which case it returns immediately).- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceInDoipMessage
-
spliterator
- Specified by:
spliteratorin interfaceIterable<InDoipSegment>
-
stream
Description copied from interface:InDoipMessageReturns an stream over elements of typeInDoipSegment.- Specified by:
streamin interfaceInDoipMessage- Returns:
- a Stream.
-