RtcpSdesItem { protected int encode(byte[] rawData, int offSet) { byte[] textData = this.text.getBytes(); this.length = (short) textData.length; rawData[offSet++] = ((byte) ((this.type & 0x000000FF))); rawData[offSet++] = ((byte) ((this.length & 0x000000FF))); System.arraycopy(textData, 0, rawData, offSet, this.length); return (offSet + this.length); } RtcpSdesItem(short type, String text); protected  RtcpSdesItem(); int getType(); int getLength(); String getText(); @Override String toString(); static final short RTCP_SDES_END; static final short RTCP_SDES_CNAME; static final short RTCP_SDES_NAME; static final short RTCP_SDES_EMAIL; static final short RTCP_SDES_PHONE; static final short RTCP_SDES_LOC; static final short RTCP_SDES_TOOL; static final short RTCP_SDES_NOTE; static final short RTCP_SDES_PRIV; }
@Test public void testEncode() { RtcpSdesItem rtcpSdesItem = new RtcpSdesItem(RtcpSdesItem.RTCP_SDES_CNAME, "QTSS1262189851"); byte[] rtcp_sdes_item = new byte[320]; int length = rtcpSdesItem.encode(rtcp_sdes_item, 0); assertEquals(p.length, length); for(int i=0;i<p.length;i++){ assertEquals(p[i], rtcp_sdes_item[i]); } }