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

java ÎļþµÄ¶Áд,×·¼Ó

дÈë¶Á³ö
String num = request.getParameter("num");
String sessionId = request.getParameter("s") + ";" + num  + "\n";
File writefile;
try{
    String path = "tt.txt";
    writefile = new File(path);
    if (writefile.exists() == false) {
        writefile.createNewFile();
        writefile = new File(path); // ÖØÐÂʵÀý»¯
    }
    FileOutputStream fos = new FileOutputStream(writefile);
    out.println("###content:" + sessionId);
    fos.write(sessionId.getBytes());
    fos.flush();
    fos.close();
    byte[] b = new byte[17*1024];
    FileInputStream fis = new FileInputStream(writefile);
    fis.read(b);
    String s = new String(b);
    out.println(s);
    fis.close();
}catch(Exception ex){
    System.out.println(ex.getMessage());
}
×·¼Ó:
String path=request.getRealPath(".");
RandomAccessFile rf=new RandomAccessFile("WriteData.txt","rw");//¶¨ÒåÒ»¸öÀàRandomAccessFileµÄ¶ÔÏ󣬲¢ÊµÀý»¯
rf.seek(rf.length());//½«Ö¸ÕëÒÆ¶¯µ½Îļþĩβ
rf.writeBytes("\nAppend a line to the file!");
rf.close();//¹Ø±ÕÎļþÁ÷
out.println("дÈëÎļþÄÚÈÝΪ£º£¼br>");
FileReader fr=new FileReader(path + "\\WriteData.txt");
BufferedReader br=new BufferedReader(fr);//¶ÁÈ¡ÎļþµÄBufferedRead¶ÔÏó
String Line=br.readLine();
while(Line!=null){
out.println(Line + "£¼br>");
Line=br.readLine();
}
fr.close();//¹Ø±ÕÎļþ


Ïà¹ØÎĵµ£º

javaµ÷Óô洢¹ý³Ì

//µ÷Óô洢¹ý³Ì´ø²Î
            CallableStatement ca = conn.prepareCall("{call Login (?,?)}");
            ca.setString(1,username);
         & ......

Javaѧϰ±Ê¼Ç1

 Ò»¡¢JavaÔËÐÐʱµÄÁ½ÖÖºËÐÄ»úÖÆ
     £¨1£©JavaÐéÄâ»ú£¨Java Virtual Machine£©
               ÓÃÀ´´¦ÀíJavaÔ´Îļþ±àÒëºóµÄ×Ö½ÚÂ룬ÆÁ±Îµ×²ãÔËÐÐÆ½Ì¨µÄ²îÒ죬ʵÏÖ“Ò»´Î±àÒë£¬Ëæ´¦Ö´ÐД£¬¶øÇÒ²»Í¬µÄÔËÐÐÆ ......

java ÈÕÆÚ¼ÆËã(¼¸Ììǰºó)

public class DateTest {
 public static void main(String[] args) {
  Date date = new Date(); // н¨Ò»¸öÈÕÆÚ
  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // ¸ñʽ»¯ÈÕÆÚ
  String beforeDate = sdf.format(getDateBefore(date, 10));
  System ......

Java communications API ʵÏÖ²¢Ðж˿ڴòÓ¡

ʹÓà Java communications API ʵÏÖ²¢Ðж˿ڴòÓ¡
 
ÕâÊÇÒ»¸öÔÚ¿Í»§Ö§³ÖÖÐÓöµ½µÄÐÂÎÊÌ⣬ÎÒÔÚÏà¹ØµÄÍøÕ¾([url]www.rxtx.org[/url] and [url]www.sun.com.cn[/url])ÉÏÕÒµ½ÁËһЩÓÐÓõÄÐÅÏ¢£¬×îºóÖÕÓÚÔÚWindows XP ºÍ LinuxIA32 ƽ̨ÏÂʵÏÖ²¢Ðж˿ڴòÓ¡ÕâÒ»¹¦ÄÜ¡£
 
Ê×ÏÈ£¬ÎÒÃÇÒª´ÓSUNµÄÍøÕ¾ÏÂÔØJava communicat ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ