|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface PacketModifier<T extends CapturePacket>
ElementModifier interface allows a capture session that is mutable (see
Capture.isMutable()) to add, insert, swap and remove packets from the
underlying packet dataset of the capture session. For example if the capture
session is file based, such as FileCapture then packets are added, inserted
or removed from the underlying capture file in response to the operations
performed by this interface.
New packets can be added in several different ways. Use one of the
add(java.nio.ByteBuffer, org.jnetstream.protocol.Protocol, long, long) methods to add the packet at the current position which is not
determined by this interface. (Usually ElementModifier objects are iterators
that maintain their own position.) There are several overloaded various of
the add(java.nio.ByteBuffer, org.jnetstream.protocol.Protocol, long, long) methods. You can use the add method to add a previously
captured packet, or you can specify the ByteBuffer containing the packet's
data and supply additional information so that appropriate packet
representation is created for the underlying capture session. The
add(java.nio.ByteBuffer, org.jnetstream.protocol.Protocol, long, long) methods are used for both appending a new packet at the end of
the dataset and inserting it if the current position is not at the end of the
dataset.
remove() and retain(java.util.Collection)
methods which can be used to remove packets from the current capture session.
These methods only take CapturePackets that came from the underlying capture
session, otherwise IllegalArgumentException will be thrown. If you want to
delete a packet, you can use the following approaches.
remove() method to remove the packet at the current
locationremove(Collection) method which will remove
several packet at the same time, found in the collection, from the underlying
capture session.retain(Collection) which will remove all packets
from the capture session, other then the ones found in the supplied
collection.Please note that it is much more efficient to utilize bulk methods as opposed to accomplishing the same task single packet at a time. The implementation is optimized to be as efficient as possible given the supplied information and the request.
| Method Summary | |
|---|---|
T |
add(java.nio.ByteBuffer b,
Protocol p,
long s,
long n)
Adds a new packet to the current capture session. |
T |
add(java.nio.ByteBuffer b,
Protocol p,
long s,
long n,
int o)
Adds a new packet to the current capture session. |
java.util.List<T> |
add(java.util.List<? extends CapturePacket> elements)
Bulk add, which adds several packets at the same time to the capture session. |
T |
add(Packet element)
Adds the supplied packet after the current position. |
T |
add(Packet element,
long s,
long n)
Adds the supplied packet after the current position. |
void |
remove()
Removes the current element. |
void |
remove(java.util.Collection<T> elements)
Bulk remove, that removes several packets from the collection. |
void |
retain(java.util.Collection<T> elements)
Bulk remove, that removes all packets other then the ones found in the collection. |
void |
swap(T first,
T second)
Swaps the two elements so that first element occupies second element's space while second element occupies previous first element's space. |
| Method Detail |
|---|
T add(java.nio.ByteBuffer b,
Protocol p,
long s,
long n)
throws java.io.IOException
b - packet buffer which contains the packet's content. The packet data
retrieved from the ByteBuffer.position() upto the
ByteBuffer.limit() properties. The included and original lengths
are calculated from these values.p - protocol number of the first protocol within the packet buffers - capture timestamp of when the packet was first captured in secondsn - capture timestamp of when the packet was first captured in
nanosecond fraction
java.io.IOException - any IO errors
T add(java.nio.ByteBuffer b,
Protocol p,
long s,
long n,
int o)
throws java.io.IOException
b - packet buffer which contains the packet's content. The packet data
retrieved from the ByteBuffer.position() upto the
ByteBuffer.limit() properties. The included length is calculated
from these values.p - protocol number of the first protocol within the packet buffers - capture timestamp of when the packet was first captured in secondsn - capture timestamp of when the packet was first captured in
nanosecond fractiono - original length of the packet data
java.io.IOException - any IO errors
java.util.List<T> add(java.util.List<? extends CapturePacket> elements)
throws java.io.IOException
elements - collection of packets to add to the capture session
java.io.IOException - any IO errors
T add(Packet element)
throws java.io.IOException
element - the packet which contains the packet buffer
java.io.IOException - any IO errors
T add(Packet element,
long s,
long n)
throws java.io.IOException
element - the packet which contains the packet buffers - capture timestamp in secondsn - capture timestamp in nanosecond fraction with value between 0 and
999,999,999
java.io.IOException - any IO errors
void remove()
throws java.io.IOException
java.io.IOException - any IO errors
void remove(java.util.Collection<T> elements)
throws java.io.IOException
Bulk remove, that removes several packets from the collection. The packets that are part of the collection, must have been created by the underlying capture session associated with this interface. For example FilePackets retain certain information about the position within the file, the packet came from and this information is needed to efficiently perform the operation.
elements - collection of packets to be removed from the underlying capture
session
java.io.IOException - any IO errors
void retain(java.util.Collection<T> elements)
throws java.io.IOException
Bulk remove, that removes all packets other then the ones found in the collection. The packets that are part of the collection, must have been created by the underlying capture session associated with this interface. For example FilePackets retain certain information about the position within the file, the packet came from and this information is needed to efficiently perform the operation.
elements - collection of packets to be removed from the underlying capture
session
java.io.IOException - any IO errors
void swap(T first,
T second)
throws java.io.IOException
first - element to swap with 'second'second - element to swap with 'first'
java.io.IOException - any IO errors
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||