Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Java Read()×èÈûµÄÒ»ÖÖ´¦Àí·½Ê½

java.io.InputStreamµÄread()·½·¨ÃèÊö£º
        If no byte is available because the end of the stream has been reached, the value -1 is returned.
        µ½´ïÁ÷µÄĩβÕæ»á·Å»Ø-1Âð£¿
        Îļþ¶ÁдÖпÉÒÔ·µ»Ø-1
      SocketͨѶÔòÓÐһ˵£¬ºÜÆæ¹ÖÎÒ·¢ÏÖcÓïÑÔËƺõ¶Áµ½Êý¾ÝÁ÷½áβ¿ÉÒԵõ½-1£»¶øJavaÖÐÔò±È½ÏÄѵõ½-1£¬¶Á²»µ½Êý¾Ýʱºòread()»áÒ»Ö±×èÈûÖÐ,´ÓJDK1.4ºóºÜ¶àÈËÊÇÓÃjava.nio,ÄÇÊÇÁíÒ»¸ö»°Ìâ¡£
      ¶ÁÈ¡socketÁ÷ÖÐÊý¾Ý£¬¸ù¾Ý-1ÅжÏÊDz»ÏÖʵµÄ£¨Í¨³£¶¨Òå¸÷×ÔͨѶЭÒ飩£¬ÕâÀïûÓп¼ÂÇÍøÂç¶ÏµôÇéÐΣ¬Ö±½Ó¶ÁÈ¡Êý¾Ý£¬¹Ø¼üÎÊÌâ¾ÍÊÇ¿¼ÂÇʲôʱºòÍ˳öÑ­»·£¬²»ÔÚ¶ÁÈ¡Êý¾Ý£¬·ñÔòread()×èÈû¡£Ë¼Â·£ºÓÃÒ»´Î¶Á1024×Ö½ÚºâÁ¿£¬×îºóÒ»´ÎûÓжÁÂú»òÕ߸պöÁÂúʱºò£¬±íʾÁ÷ÖÐûÓÐÊý¾ÝÁË¡£
½ÓÊն˴úÂëƬ¶Î£º
InputStream is = socket.getInputStream();
int len = 0;
byte[] buf = new byte[1024];
StringBuffer sbf = new StringBuffer();
String temp = null;
int i = 0;
len = is.read(buf);
while(true){
temp = new String(buf,0,len);
sbf.append(temp);
if(len>=buf.length){
len = is.read(buf);
}else{
break ;
}
}


Ïà¹ØÎĵµ£º

Java »·¾³±äÁ¿µÄÅäÖÃ

ÔÚjava»·¾³±äÁ¿ÅäÖÃÉÏץס “Á½Ìí¼Ó£¬ÒÔÐ޸ľÍOKÁË”
°´×¡windows¼ü+PauseBreak¼üÖ±½ÓÔڸ߼¶ÖеĻ·¾³±äÁ¿´¦ÉèÖÃ
1.Ìí¼Ó
CLASSPATH
.;C:\Program Files\Java\jdk1.6.0_02\lib;£¨ÕâÊÇÄãJdk°²×°µÄĿ¼Ïµİü£©
 
2.Ìí¼Ó
JAVA_HOME
C:\Program Files\Java\jdk1.6.0_02
3.ÐÞ¸Ä
ÐÞ¸Äpath±äÁ¿
C:\Progra ......

java±¾¼Í

JavaÐéÄâ»úµÄÆðÔ´Óë¹¹Ôì
µ±ÎÒÃÇ˵µ½“Java”Õâ¸ö´ÊµÄʱºò£¬Ö¸µÄÊÇËĸöÏ໥¹ØÁªµÄ¸ÅÄJavaÓïÑÔ¡¢Java API¡¢Java ClassÎļþ¸ñʽ¡¢JavaÐéÄâ»ú¡£Õû¸öJavaÌåϵÊÇ»ùÓÚJava ÐéÄâ»ú¹¹ÔìµÄ£¬ÕýÒòΪÈç´Ë£¬²ÅÄÜʵÏÖJavaµÄ°²È«ÐÔºÍÍøÂçÒƶ¯ÐÔ¡£Java²¢·ÇÊǵÚÒ»¸ö²ÉÓÓÐéÄâ»ú”¸ÅÄîµÄÌåϵ£¬µ«È´ÊǵÚÒ»¸öµÃµ½¹ã·ºÔ ......

Flex Compile Error: Error: Java heap space

ÓÉÓÚFlex Builder compiler shellÓÐmemory leakµÄÎÊÌ⣬ ¶øSDKĬÈÏµÄµÄ JVM heap size Ö»ÓÐ312M£¬µ±compile±È½Ï´óµÄprojectÈÝÒײ»¹»£¬ËùÒÔÖ»ÒªÐÞ¸ÄSDKµÄJVM²ÎÊý¾Í¿ÉÒÔ¡£
±à¼­ {Flex SDK}/bin/jvm.config ÎļþÈçÏ¡£
java.args=-Xmx512m ...
Èç¹û»¹ÊÇÓÐError£¬¿ÉÒÔÔö¼Óµ½1024»òÕ߸ü¶à¡£ ......

JavaÕýÔòÑéÖ¤

import java.util.regex.*;

public final class RegExpValidator
{
/**
* ÑéÖ¤ÓÊÏä
* @param ´ýÑéÖ¤µÄ×Ö·û´®
* @return Èç¹ûÊÇ·ûºÏµÄ×Ö·û´®,·µ»Ø <b>true </b>,·ñÔòΪ <b>false </b>
*/
public static boolean isEmail(String str)
{ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ