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

Java´Óweb·þÎñÆ÷ÏÂÔØÎļþµ½±¾µØ

/*´Ó·þÎñÆ÷ÖÐÏÂÔØÎļþµ½±¾µØ*/
/*url:Îļþ´æ·ÅÔÚ·þÎñÆ÷µÄµØÖ·£»target:Òª±£´æµÄ·¾¶*/
 
public String DownloadFile(String url,String target){
URLConnection con=null;
URL theUrl=null;
try {
theUrl=new URL(url);//½¨Á¢µØÖ·
con = theUrl.openConnection();//´ò¿ªÁ¬½Ó
con.setConnectTimeout(30000);
con.connect();//Á¬½Ó
} catch (MalformedURLException e) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, e);
return "¸ø¶¨µÄURLµØÖ·ÓÐÎó£¬Çë²é¿´";
}
catch (IOException e) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, e);
return "ÎÞ·¨Á¬½Óµ½Ô¶³Ì»úÆ÷£¬ÇëÖØÊÔ£¡";
}
jLabel5.setText("¡Ì");
Process++;
File file = new File(gbl_ParentPath+"/UpdateTemp");
if(file.exists()==false){
file.mkdir();
}
String type = con.getContentType();
if (type != null) {
byte[] buffer = new byte[4 * 1024];
int read;
try {
FileOutputStream os = new FileOutputStream(target);
InputStream in = con.getInputStream();//ÖØ¶¨ÏòÊäÈë
while ((read = in.read(buffer)) > 0) {//¶ÁÈ¡Êä³ö
os.write(buffer, 0, read);//дÈë±¾µØÎļþ
}
os.close();
in.close();
jLabel6.setText("¡Ì");
Process++;
} catch (FileNotFoundException e) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, e);
return "ËùÒªÏÂÔØµÄÎļþ²»´æÔÚ£¡";
}catch (IOException e) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, e);


Ïà¹ØÎĵµ£º

javaÎļþ·ÃÎÊFileÀ༰Æä¹ýÂË

import java.io.*;
class FileTest
{
 public static void main(String[] args) throws Exception
 {
  //File f=new File("1.txt");
  //f.createNewFile();
  //f.mkdir();
  //File f=new File("E:\\JavaLesson\\Lesson7\\1.txt");//ÔÚWindowsϵͳÏÂ,Óþø¶Ô ......

FLASH+JAVA¿ª·¢ÊµÊ±ÍøÂçÓÎÏ·

 ±¾ÎÄ·ÖÁ½²¿·Ö£ºFLASH±à³Ì ºÍ Java±à³Ì£¬´ËÎļǼµÄ½ö½öÊÇÎÒÔÚ̽Ë÷ÖеÄһЩÊÕ»ñ£¬ÆäÖÐÓÃÁ˺ܶà¸öÈË»¯µÄÃèÊöÓïÑÔ£¬²¢²»ÊÇÒµ½ç±ê×¼µÄÓÃÓï¡£ £º£©
̽Ë÷±Ê¼Ç£º  
Ŀǰ¹úÄÚFlashÓ¦Óô󲿷ֻ¹ÊÇÔÚÖÆ×÷¾«ÃÀµÄ¶¯»­·½Ã棬µ«¾ÝÎÒÁ˽âÔçÔÚFlash4 µÄʱ´ú£¬¹úÍâһЩÈ˾ÍÒѾ­¿ªÊ¼½«flash¼¼ÊõÔËÓÃÓÚ¿ª·¢¶¯Ì¬ÍøÕ¾£¨ºÍphp¡ ......

javaÀàÐÍѧϰ


Ò»¸öjavaÎļþÖУ¬ÓÐÇÒÖ»ÓÐÒ»¸öpublicÀà
float ff= 1.3f;(4B)
int 4B;
long 8B;
double 8B;
byte Ò»×Ö½ÚÕûÐÍ
char 2B
Êý×é
int num[] = new int[3];
int[] num;
num = new int[3];
int [] num = new int[]{1,2,3};
int [][] num;
num = new int[3][4];
//²»Í¬³¤
num = new int[3][];
num[0] = new int[5]; ......

JavaʵÏÖ¶ÓÁвÙ×÷


import java.util.LinkedList;  
//µ¥Ïò¶ÓÁР 
public class Queue {  
    public Queue() {  
    }  
    private LinkedList list = new LinkedList();  
    public void pu ......

java Áª¶¯

 JSP£ºjavascript ºÍ struts²¿·Ö
<table width="100%" border="0" cellspacing="0" cellpadding="6">
<tr>
<td>
<span class="txt1">Èý¼¶µ¥Î»£º</span>
<html:select property="oilarea" style="width:182" styleId="area" onchange="javascript:fillWell()"&g ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ