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() |
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(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 IOException
hasPadding in interface RtpPacketIOExceptionpublic boolean hasExtensions()
throws IOException
hasExtensions in interface RtpPacketIOExceptionpublic boolean hasMarker()
throws IOException
hasMarker in interface RtpPacketIOExceptionpublic int getPayloadType()
throws IOException
getPayloadType in interface RtpPacketIOExceptionpublic int getSeqNumber()
throws IOException
getSeqNumber in interface RtpPacketIOExceptionpublic long getTimestamp()
throws IOException
getTimestamp in interface RtpPacketIOExceptionpublic long getSyncronizationSource()
throws IOException
getSyncronizationSource in interface RtpPacketIOExceptionpublic int getContributingSource()
throws IOException
getContributingSource in interface RtpPacketIOExceptionpublic 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 byte[] dumpPacket()
RtpPacketRtpPacket as a raw byte-array.dumpPacket in interface RtpPacketpublic void write(OutputStream out, Buffer payload) throws IOException
PacketOutputStream with the supplied payload.
You can use this method to e.g. write a raw UDPPacket to the
stream with this payload. Note, if the UDPPacket already had a
payload it will be ignored so use this method with care.write in interface PacketIOExceptionpublic RtpPacket clone()
clone in interface Packetclone in class AbstractPacketpublic Packet getNextPacket() throws IOException
PacketgetNextPacket in interface PacketIOExceptionpublic 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 © 2021. All Rights Reserved.