PoC TBCPÏûÏ¢½âÎöºÍ¹¹ÔìµÄJAVAʵÏÖ
TBCPMessageFactory.java
/**
* ÎļþÃû: TBCPMessageFactory.java
*/
package tbcpstack;
import java.text.MessageFormat;
import org.apache.log4j.Logger;
import TBCPException;
/**
*
* TODO TBCPÏûÏ¢¹¹½¨¹¤³§
*/
public class TBCPMessageFactory {
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(TBCPMessageFactory.class);
private static final String POCNAME = "PoC1";
/**
* °´ÕÕOMA PoC UserPlaneÀï¹æ¶¨µÄTBCP Talk Burst RequestÏûÏ¢¸ñʽ½øÐй¹Ôì¡£
*
* @param ssrc
* SSRC of PoC Client requesting permission to send a talk burst
* @param priority
* Ö»ÄÜΪ1¡¢2¡¢3¡£ 1 - normal priority£»2 - high priority£»3 -
* pre-emptivepriority
* @return bytes of TalkBurstRequest
* @throws TBCPException
*/
public static byte[] createTBCPTalkBurstRequest(long ssrc, int priority) throws TBCPException {
if ((1 <= priority) && (priority <= 3)) {
byte[] data = new byte[16];
data[0] = 102;// TB-priority-level
data[1] = 2;// TB-priority-length
byte[] priorityValueBytes = ByteConversion.uIntIntToByteWord(priority);// TB-priority
// value
data[2] = priorityValueBytes[0];
data[3] = priorityValueBytes[1];
data[4] = 103;// Time-stamp
data[5] = 8;// Time-stamp-length
// Timestamp value
byte[] timeStampValueBytes = ByteConversion.longToByte(TimeStamp.getCurrentTime().ntpValue());
for (int i = 0; i < 8; i++) {
data[i + 6] = timeStampValueBytes[i];
}
data[14] = 0;// ºóÁ½Î»Òª²¹Îª0
data[15] = 0;
byte[] name = POCNAME.getBytes();
return prepareRTCPAppPacket(ssrc, TBCPMessageType.TBCP_REQUEST, name, data);
Ïà¹ØÎĵµ£º
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......
java¼¯ºÏ¿ò¼Üͼ¼°½éÉÜ
ת×Ô:http://hi.baidu.com/%C9%AE_%CC%C6/blog/item/9e2a8b0887008a8ad0581b3d.html
¼ò»¯Í¼£º
Javaƽ̨ÌṩÁËÒ»¸öȫеļ¯ºÏ¿ò¼Ü¡£“¼¯ºÏ¿ò¼Ü”Ö÷ÒªÓÉÒ»×éÓÃÀ´²Ù×÷¶ÔÏóµÄ½Ó¿Ú×é³É¡£²»Í¬½Ó¿ÚÃèÊöÒ»×鲻ͬÊý¾ÝÀàÐÍ¡£
Java 2¼¯ºÏ¿ò¼Üͼ
¼¯ºÏ½Ó¿Ú£º6¸ö½Ó¿Ú£¨¶ÌÐéÏß±íʾ£©£¬±íʾ²»Í ......
1, ±£Ö¤Ḭ̈߳²È«µÄÈýÖÖ·½·¨: a, ²»Òª¿çÏ̷߳ÃÎʹ²Ïí±äÁ¿b, ʹ¹²Ïí±äÁ¿ÊÇfinalÀàÐ͵Äc, ½«¹²Ïí±äÁ¿µÄ²Ù×÷¼ÓÉÏͬ²½
2, Ò»¿ªÊ¼¾Í½«ÀàÉè¼Æ³ÉḬ̈߳²È«µÄ, ±ÈÔÚºóÆÚÖØÐÂÐÞ¸´Ëü,¸üÈÝÒ×.
3, ±àд¶àÏ̳߳ÌÐò, Ê×Ïȱ£Ö¤ËüÊÇÕýÈ·µÄ, Æä´ÎÔÙ¿¼ÂÇÐÔÄÜ.
4, ÎÞ ......
×î½ü¿ªÊ¼ÔÚ¿´java£¬¶ÔAppletÕâ½Ú±È½Ï¸ÐÐËȤ£¬¸ÄÁ˸ÄÊéÉϵĴúÂ룬Ȩµ±Áô¸öÓ¡¼Ç
import java.awt.*;
import java.applet.*;
public class HelloApplet extends Applet
{
Font f1 = new Font("Times New Roman", Font.PLAIN, 12);
Font f2 = new Font("ËÎÌå", Font.BOLD, 24);
Font f3 = new Font("ºÚÌå", Fon ......
ʹÓÃJava·¢ËÍGET¡¢POSTÇëÇó
——½ÚÑ¡×Ô¡¶·è¿ñJava½²Òå¡·
URLµÄopenConnection()·½·¨½«·µ»ØÒ»¸öURLConnection¶ÔÏ󣬸öÔÏó±íʾӦÓóÌÐòºÍ URL Ö®¼äµÄͨÐÅÁ´½Ó¡£³ÌÐò¿ÉÒÔͨ¹ýURLConnectionʵÀýÏò¸ÃURL·¢ËÍÇëÇ󡢶ÁÈ¡URLÒýÓõÄ×ÊÔ´¡£
ͨ³£´´½¨Ò»¸öºÍ URL µÄÁ¬½Ó£¬²¢·¢ËÍÇëÇ󡢶ÁÈ¡´Ë URL ÒýÓõÄ×ÊÔ´ÐèÒªÈçÏ ......