public final class RtpPacketImpl extends AbstractPacket implements RtpPacket
| Constructor and Description |
|---|
RtpPacketImpl(TransportPacket parent,
Buffer headers,
Buffer payload) |
| Modifier and Type | Method and Description |
|---|---|
RtpPacket |
clone() |
byte[] |
dumpPacket()
Dump the entire
RtpPacket as a raw byte-array. |
long |
getArrivalTime()
The arrival time of this packet in microseconds relative to epoch
(midnight UTC of January 1, 1970).
|
int |
getContributingSource() |
Packet |
getNextPacket()
Get the next frame, or null if there is none.
|
TransportPacket |
getParentPacket()
Almost all packets have a parent, which is the encapsulating protocol.
|
int |
getPayloadType() |
int |
getSeqNumber() |
long |
getSyncronizationSource() |
long |
getTimestamp() |
int |
getVersion() |
boolean |
hasExtensions() |
boolean |
hasMarker() |
boolean |
hasPadding() |
java.lang.String |
toString() |
void |
verify()
Calling this method will force the packet to completely parse its data
and check so that all the information conforms to whatever rules this
packet needs to follow.
|
void |
write(java.io.OutputStream out,
Buffer payload)
Writes this packet to the
OutputStream with the supplied payload. |
checkParent, getName, getPacket, getPayload, getProtocol, hasProtocol, writeequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetName, getPacket, getPayload, getProtocol, hasProtocol, writepublic RtpPacketImpl(TransportPacket parent, Buffer headers, Buffer payload)
public int getVersion()
getVersion in interface RtpPacketpublic boolean hasPadding()
throws java.io.IOException
hasPadding in interface RtpPacketjava.io.IOExceptionpublic boolean hasExtensions()
throws java.io.IOException
hasExtensions in interface RtpPacketjava.io.IOExceptionpublic boolean hasMarker()
throws java.io.IOException
public int getPayloadType()
throws java.io.IOException
getPayloadType in interface RtpPacketjava.io.IOExceptionpublic int getSeqNumber()
throws java.io.IOException
getSeqNumber in interface RtpPacketjava.io.IOExceptionpublic long getTimestamp()
throws java.io.IOException
getTimestamp in interface RtpPacketjava.io.IOExceptionpublic long getSyncronizationSource()
throws java.io.IOException
getSyncronizationSource in interface RtpPacketjava.io.IOExceptionpublic int getContributingSource()
throws java.io.IOException
getContributingSource in interface RtpPacketjava.io.IOExceptionpublic void verify()
IPPacket, hardly does anything
in this method but more complex protocols such as SIP (once again), HTTP
etc can spend quite some time verifying everything, which is why you
don't want to do it unless you really have to.
In general, yajpcap has the philosophy of
"assume that everything is ok until things blow up and then deal with it"verify in interface Packetverify in class AbstractPacketpublic long getArrivalTime()
SimpleDateFormat but it can
only handle milliseconds precision (you will have to write your own date
formatter if you want microseconds).
Here is a snippet illustrating how to turn the arrival time of the packet
into a human readable date
Packet p = ...;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss.SSS");
Date date = new Date(p.getArrivalTime() / 1000);
System.out.println("Arrival time: " + formatter.format(date));
Note how an integer devision is performed on the arrival time to
"cut off" the microseconds from the time stampgetArrivalTime in interface Packetpublic java.lang.String toString()
toString in class java.lang.Objectpublic byte[] dumpPacket()
RtpPacketRtpPacket as a raw byte-array.dumpPacket in interface RtpPacketpublic void write(java.io.OutputStream out,
Buffer payload)
throws java.io.IOException
Packetpublic RtpPacket clone()
clone in interface Packetclone in class AbstractPacketpublic Packet getNextPacket() throws java.io.IOException
PacketgetNextPacket in interface Packetjava.io.IOExceptionpublic TransportPacket getParentPacket()
PacketSipPacket is typically a
TransportPacket such as UDPPacket or a TCPPacket.
The parent of a TransportPacket is usually a IPPacket and
so on.getParentPacket in interface PacketgetParentPacket in interface RtpPacketgetParentPacket in class AbstractPacketCopyright © 2018. All Rights Reserved.