pcap.codec.PacketIterator Maven / Gradle / Ivy
/** This code is licenced under the GPL version 2. */
package pcap.codec;
import java.util.Iterator;
import java.util.NoSuchElementException;
import pcap.common.annotation.Inclubating;
/** @author Ardika Rommy Sanjaya */
@Inclubating
class PacketIterator implements Iterator {
private Packet next;
public PacketIterator(final Packet packet) {
this.next = packet;
}
@Override
public boolean hasNext() {
return next != null;
}
@Override
public Packet next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
Packet previous = next;
next = next.payload();
return previous;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy