*
* @param in IoBuffer
* @return Ping event
*/
public Ping decodePing(IoBuffer in) {
Ping ping = null;
if (log.isTraceEnabled()) {
// gets the raw data as hex without changing the data or pointer
String hexDump = in.getHexDump();
log.trace("Ping dump: {}", hexDump);
}
// control type
short type = in.getShort();
switch (type) {
case Ping.CLIENT_BUFFER:
ping = new SetBuffer(in.getInt(), in.getInt());
break;
case Ping.PING_SWF_VERIFY:
// only contains the type (2 bytes)
ping = new Ping(type);
break;
case Ping.PONG_SWF_VERIFY:
byte[] bytes = new byte[42];
in.get(bytes);
ping = new SWFResponse(bytes);
break;
default:
//STREAM_BEGIN, STREAM_PLAYBUFFER_CLEAR, STREAM_DRY, RECORDED_STREAM
//PING_CLIENT, PONG_SERVER
//BUFFER_EMPTY, BUFFER_FULL
ping = new Ping(type, in.getInt());
break;
}
return ping;
}