Package net.dona.doip

Class InDoipMessageImpl

java.lang.Object
net.dona.doip.InDoipMessageImpl
All Implemented Interfaces:
AutoCloseable, Iterable<InDoipSegment>, InDoipMessage

public class InDoipMessageImpl extends Object implements InDoipMessage
An implementation of InDoipMessage which reads a serialized DOIP message from an InputStream object.
  • Constructor Details

    • InDoipMessageImpl

      public InDoipMessageImpl(InputStream in)
      Constructs an InDoipMessage object using the serialized DOIP message from the supplied InputStream.
      Parameters:
      in - the input stream from which to read the serialized DOIP message
  • Method Details

    • setCompleter

      public void setCompleter(CompletableFuture<?> completer)
      Sets the CompletableFuture object of this InDoipMessageImpl object, which will be completed when the message is fully processed. It will be completed normally with null 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

      public BadDoipException getTerminalException()
      If the DOIP message was malformed, retrieves a BadDoipException indicating how; otherwise returns null.
      Returns:
      an instance of BadDoipException which indicates how the DOIP message was malformed, or null
    • iterator

      public Iterator<InDoipSegment> iterator()
      Specified by:
      iterator in interface Iterable<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 interface AutoCloseable
      Specified by:
      close in interface InDoipMessage
    • spliterator

      public Spliterator<InDoipSegment> spliterator()
      Specified by:
      spliterator in interface Iterable<InDoipSegment>
    • stream

      public Stream<InDoipSegment> stream()
      Description copied from interface: InDoipMessage
      Returns an stream over elements of type InDoipSegment.
      Specified by:
      stream in interface InDoipMessage
      Returns:
      a Stream.