Java RandomAccessFile дÈëtxtÎļþ - Java / Java SE
ÓÃRandomAccessFileдÈëTXTÎļþ²é¿´Ê±ÊÇÂÒÂ룬ÇëÎÊÓÐʲô·½·¨¿ÉÒÔд³É¿É¶ÁµÄÎļþ£¬²»ÊÇÓÃÆäËûµÄÎļþ²Ù×÷£¬¾ÍÊÇÖ»ÓÃRandomAccessFileµÄ·½·¨ÊÇ·ñ¿ÉÒÔʵÏÖ£¿
Java code:
import java.io.*;
public class RandomAccessFileDemo
{
public static void main(String[] args) throws IOException
{
RandomAccessFile raf=new RandomAccessFile("random.txt","rw");
raf.writeBoolean(true);
raf.writeInt(2008);
raf.writeChar('Äê');
raf.writeDouble(08.08);
raf.writeUTF("Å·ÁÖÆ¥¿ËÔ˶¯»á");
raf.seek(1);
System.out.println(raf.readInt());
System.out.println(raf.readChar());
System.out.println(raf.readDouble());
System.out.println(raf.readUTF());
raf.seek(0);
System.out.println(raf.readBoolean());
raf.close();
}
}
ÕâÖÖÂÒÂëÒ»°ã¶¼ÊÇÒòΪ×Ö·û´®µÄ±àÂë»òÕß×Ö·û´®×ª»»×Ö½ÚµÄʱºò±àÂ벻ͬ¶øÒýÆðµÄ¡£ËùÒÔÊ×ÏÈ×îºÃ¶ÔҪдÈëÎļþµÄ×Ö·û´®»òÕßÁ÷¶¼½øÐÐÒ»±é±àÂëÉ趨¡£
1¡¢String.getBytes£¨£©½«»á°´ÕÕµ±Ç°ÏµÍ³Ä¬ÈϵÄencoding·½Ê½»ñµÃ×Ö·û´®µÄ Bytes£¬RandomAccessFile.write(byte[])½«Õâ¸öbyteÊý×éÕýȷдÈë¡£ÓÉÓÚдÈëµÄʵ¼Ê¾ÍÊÇWindowsƽ̨µÄ nativecode±àÂ룬ËùÒÔÎļþ»¹Äܹ»±»ÕýÈ·µÄÔĶÁ¡£
2¡¢RandomAccessFile.writeBytes(String)½«×Ö·û´®µÄ¸÷¸ö×Ö·û£¨µ±È»ÊÇÓÃunicode±àÂëµÄ£©µÄ¸ß8λȥµô£¬Ð´ÈëÎļþ¡£
3¡¢RandomAccessFile.writeChars(String)½«×Ö·û´®µÄ¸÷¸ö
Ïà¹ØÎÊ´ð£º
ÎÒÏÖÔÚÏëÓÃsshÕûºÏÀ´×öÒ»¸öÂÛ̳£¬µ«Êý¾Ý¿â·½Ãæ²»ÐУ¬ÎÒÖ÷Òª²»»áÉæ¼°Êý¾Ý¿â£¬²»ÖªµÀ·¢Ìû±í£¬ºÍ»ØÌû±íÒªÈçºÎÉè¼ÆºÍÇø·Ö¡£²»ÖªµÀËÓÐÒ»¸ö¼òµ¥µÄ˼·£¬À´Éè¼ÆÕâЩ±í¡£Ð»Ð»ÁË¡£
·¢ÌûºÍ»ØÌûÓÃͬһÕÅ±í ¡£·¢Ìû id user ......
jspѧϰǰҪÁ˽âÄÇЩ֪ʶ£¿Ñ§ÁËjavaÁË¡£²»ÖªµÀ»¹ÒªÑ§Ï°Ð©Ê²Ã´ÖªÊ¶²Å¿ÉÒԺܺõÄѧϰjsp
HTML¡¢JavaScript
Ö±½Óѧ¾Í¿ÉÒÔÁË£¬Óöµ½²»»á¾ÍÏÖѧ¾ÍÐС£
Html css servlet
È¥Á˽âä¯ÀÀÆ÷Óëweb·þÎñÆ÷µÄ¼òµ¥½» ......
ÎÒÔÚeclipseÖÐдÁËÒ»¸ö²¥·ÅÒôÀÖµÄÀ࣬²¢°ÑÒôÀÖÎļþºÍÀàÎļþ·ÅÔÚÁËÒ»Æ𣬽á¹ûÔËÐÐʱ£¬³öÏÖ´íÎó£¬ËµÊÇÒôÀÖÎļþÄǸöÊǿյģ¬µ«ÊÇÔÚjcreatorÓÃͬÑùµÄ·½·¨½á¹ûÊÇ¿ÉÒÔÔËÐеģ¬ÇëÇó¸ß˵ָ½Ì£¬¸æËßΪʲô£¿¼±
ÄãÈôÊÇÔÚWindo ......
android ÏÖÔÚÖ»Ö§³ÖJAVAô£¿ ¿ÉÒÔÓà c++ ô£¿
Ö÷ÒªÊÇÓÃJava£¬ÏëʹÓÃC++µÄ»°¿ÉÒÔÓÃGoogle·¢²¼µÄNDK
×öÓ¦Óÿɶ¨ÊÇÒªÓõ½JavaµÄ£¬ÒòΪӦÓÿò¼Ü¾ÍÊÇJavaµÄ£¬µ«ÊDz¿·Ö´úÂë¿ÉÒÔÓÃC++À´Ð´
¿ÉÒԵġ£¡£
òËƲ»¿ÉÒÔ° ......