net.sf.fmj.media.rtp.util.Packet Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fmj Show documentation
Show all versions of fmj Show documentation
Freedom for Media in Java
package net.sf.fmj.media.rtp.util;
import java.util.*;
/**
*
* @author Lyubomir Marinov
*/
public class Packet
{
public byte data[];
public int offset;
public int length;
public boolean received;
public long receiptTime;
/**
* The bitmap/flag mask that specifies the set of boolean attributes enabled
* for this RawPacket. The value is the logical sum of all of the
* set flags. The possible flags are defined by the FLAG_XXX
* constants of FMJ's {@link Buffer} class.
*/
public int flags;
public Packet()
{
received = true;
}
public Packet(Packet p)
{
received = true;
data = p.data;
offset = p.offset;
length = p.length;
received = p.received;
receiptTime = p.receiptTime;
flags = p.flags;
}
@Override
public Packet clone()
{
Packet p = new Packet(this);
p.data = data.clone();
return p;
}
@Override
public String toString()
{
String s = "Packet of size " + length;
if (received)
s = s + " received at " + new Date(receiptTime);
return s;
}
}