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

Java ¶ÏµãÐø´«

±¾ÎÄ´Óhttp://www.blogjava.net/breezedancer/archive/2007/07/19/131264.htmlתÔØ
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
//¶ÏµãÐø´«
public class Download {
public static void down(String URL, long nPos, String savePathAndFile) {
try {
URL url = new URL(URL);
HttpURLConnection httpConnection = (HttpURLConnection) url
.openConnection();
// ÉèÖÃUser-Agent
httpConnection.setRequestProperty("User-Agent", "NetFox");
// ÉèÖöϵãÐø´«µÄ¿ªÊ¼Î»ÖÃ
httpConnection.setRequestProperty("RANGE", "bytes=" + nPos);
// »ñµÃÊäÈëÁ÷
InputStream input = httpConnection.getInputStream();
RandomAccessFile oSavedFile = new RandomAccessFile(savePathAndFile,
"rw");
// ¶¨Î»ÎļþÖ¸Õëµ½nPosλÖÃ
oSavedFile.seek(nPos);
byte[] b = new byte[1024];
int nRead;
// ´ÓÊäÈëÁ÷ÖжÁÈë×Ö½ÚÁ÷£¬È»ºóдµ½ÎļþÖÐ
while ((nRead = input.read(b, 0, 1024)) > 0) {
(oSavedFile).write(b, 0, nRead);
}
httpConnection.disconnect();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public static long getRemoteFileSize(String url) {
long size = 0;
try {
HttpURLConnection conn = (HttpURLConnection) (new URL(url))
.openConnection();
size = conn.getContentLength();
conn.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
return size;
}
public static void main(String[] args) {
String url = "http://www.blogjava.net/bree


Ïà¹ØÎĵµ£º

JavaÖм¯ºÏÈÝÆ÷ÀàListºÍSetµÄÓ÷¨

ListµÄÓ÷¨
List°üÀ¨List½Ó¿ÚÒÔ¼°List½Ó¿ÚµÄËùÓÐʵÏÖÀà¡£ÒòΪList½Ó¿ÚʵÏÖÁËCollection½Ó¿Ú£¬ËùÒÔList½Ó¿ÚÓµÓÐCollection½Ó¿ÚÌṩµÄËùÓг£Ó÷½·¨£¬ÓÖÒòΪListÊÇÁбíÀàÐÍ£¬ËùÒÔList½Ó¿Ú»¹ÌṩÁËһЩÊʺÏÓÚ×ÔÉíµÄ³£Ó÷½·¨£¬Èç±í1Ëùʾ¡£
±í1  List½Ó¿Ú¶¨ÒåµÄ³£Ó÷½·¨¼°¹¦ÄÜ
´Ó±í1¿ÉÒÔ¿´³ö£¬List½Ó¿ÚÌṩµÄÊʺÏÓÚ×ÔÉíµÄ ......

java Á÷£¨×ªÔØ£©

ÓÉÓÚÊÖÍ·ÓиöÏîÄ¿ÐèÒªÓõÄJavaµÄÊäÈëÊä³ö²Ù×÷£¬
¡¡¡¡ËùÒÔ£¬¿ÐÁ˼¸ÌìÊ飬¶ÔJavaµÄÁ÷¼¼ÊõÓÐЩÁ˽⣬²»¹ý£¬»¹ÊÇÓкܶ಻ÊǺÜÃ÷°×£¬ÏÂÃæÊÇÎÒ¿´ÊéÕûÀíµÄһЩ±Ê¼Ç£¬ÑϸñµÄ˵Ӧ¸Ã²»ÊÇÔ­´´£¬ÎÒÌù³öÀ´Ö»ÊÇÏ£Íû¶Ô´ó¼ÒÓÐһЩ°ïÖú
¡¡¡¡
¡¡¡¡1¡¢JavaÓµÓÐÒ»¸öÍêÕûµÄÁ÷ÀàÐÍ£¬×ÜÊý³¬¹ý60£¬¶øËĸö³éÏóÀ๹³ÉÁËÕâЩÀàµÄ»ù´¡
¡¡¡¡
¡¡¡¡In ......

¹ØÓÚ Java ¶ÔÏóÐòÁл¯Äú²»ÖªµÀµÄ 5 ¼þÊÂ

ÊýÄêÇ°£¬µ±ºÍÒ»¸öÈí¼þÍŶÓÒ»ÆðÓà Java ÓïÑÔ±àдһ¸öÓ¦ÓóÌÐòʱ£¬ÎÒÌå»áµ½±ÈÒ»°ã³ÌÐòÔ±¶àÖªµÀÒ»µã¹ØÓÚ Java ¶ÔÏóÐòÁл¯µÄ֪ʶËù´øÀ´µÄºÃ´¦¡£
¹ØÓÚ±¾ÏµÁÐ
Äú¾õµÃ×Ô¼º¶® Java ±à³Ì£¿ÊÂʵÉÏ£¬´ó¶àÊý³ÌÐòÔ±¶ÔÓÚ Java ƽ̨¶¼ÊÇdz³¢ÔòÖ¹£¬Ö»Ñ§Ï°ÁË×ãÒÔÍê³ÉÊÖÍ·ÉÏÈÎÎñµÄ֪ʶ¶øÒÑ¡£
´óÔ¼Ò»ÄêÇ°£¬Ò»¸ö¸ºÔð¹ÜÀíÓ¦ÓóÌÐòËùÓÐÓû§ÉèÖà ......

java¿ò¼ÜѧϰÌå»á

      ×î½üÔÚѧϰjavaµÄ¿ò¼Ü£¬¼ÓÉîÁ˶ÔjavaһЩÉè¼ÆģʽµÄÀí½â£¬ÀýÈçÄ£°å·½·¨Ä£Ê½¡¢²ßÂÔģʽ¡¢´úÀíģʽºÍ¶¯Ì¬´úÀíģʽ£¬·¢ÏÖѧϰÀí½âservletºÍjspºóºÜÈÝÒ×¾Íѧ»áÁËstruts£¬Ñ§Ï°jdbcºó±È½ÏÈÝÒ×Àí½âhibernate£¬±¾ÈË»¹Ã»¿ªÊ¼Ñ§Ï°spring¡£
      ¶Ôstruts¿ò¼ÜµÄÀí½â£ºÖ÷ÒªÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ