Class MTSValidPacketIterator

java.lang.Object
org.codice.ddf.libs.mpeg.transport.MTSValidPacketIterator

public class MTSValidPacketIterator extends Object
Support class for working with a stream of packets from a source where the underlying data may cause exceptions. In this case, a greedy approach is taken; every bad packet is ignored without limit in hopes good data will be encountered.

Caution: Be careful when modifying this class. Methods here mutate its state. While a recursive solution would have been preferrable, ingested products with sufficiently large segments of bad data would cause a stack overflow.

  • Constructor Details

    • MTSValidPacketIterator

      public MTSValidPacketIterator(org.taktik.mpegts.sources.ResettableMTSSource source)
  • Method Details

    • getPacketsProcessed

      public long getPacketsProcessed()
    • getPacketsFailed

      public long getPacketsFailed()
    • getNextValidPacket

      public org.taktik.mpegts.MTSPacket getNextValidPacket()
      Iterate through any number of exception-causing packets to reach either a valid one or the end of the packet stream.
      Returns:
      The next packet in the provided source that does not throw an exception. Or null if no more packets are available.