Java¶ÁдCSVÎļþ
CSVÎļþ¼ò½é
¶ººÅ·Ö¸ôÐÍÈ¡Öµ¸ñʽ£¨Ó¢ÎÄÈ«³ÆΪComma Separated Values£¬¼ò³ÆCSV£©£¬ÊÇÒ»ÖÖ´¿Îı¾¸ñʽ£¬ÓÃÀ´´æ´¢Êý¾Ý¡£ÔÚCSVÖУ¬Êý¾ÝµÄ×Ö¶ÎÓɶººÅ·Ö¿ª£¬³ÌÐòͨ¹ý¶ÁÈ¡ÎļþÖØд´½¨ÕýÈ·µÄ×ֶΣ¬·½·¨ÊÇÿ´ÎÓöµ½¶ººÅʱ¿ªÊ¼ÐÂÒ»¶ÎÊý¾Ý¡£
CSVÎļþÊÇÒ»¸ö¼ÆËã»úÊý¾ÝÎļþÓÃÓÚÖ´ÐÐÉóÅкÍÕæÕýµÄ×éÖ¯¹¤¾ß£¬¶ººÅ·Ö¸ôµÄÇåµ¥¡£³£³£±»ÓÃÓÚÒƶ¯±í¸ñÊý¾ÝÖ®¼äµÄÁ½¸ö²»Í¬µÄ¼ÆËã»ú³ÌÐò£¬ÀýÈç¹ØϵÊý¾Ý¿â³ÌÐòºÍµç×Ó±í¸ñ³ÌÐò¡£
±¾ÎÄÒÔÏÂÃæÕâ¸öCSVÎļþΪÀý£¬Ïò´ó¼Ò¼òÒª½éÉÜJavaÓïÑÔµÄCSV¶Áд²Ù×÷µÄÒ»ÖÖʵÏÖ·½·¨¡£
writers.csv
ÕÅÒÕı,1951,1114
СÉòÑô,1981,0507
ËïºìÀ×,1970,0816
ãÆÄÝ,1971,0310
CSV¶ÁÈ¡²Ù×÷
CSVÎļþ¶ÁÈ¡Ö÷ÒªÓõ½java.io.BufferedReaderÀàºÍjava.util.StringTokenizerÀ࣬BufferedReaderÓÃÀ´¶ÁÈëÎļþ£¬StringTokenizerÓÃÀ´½«Ò»ÐÐÊý¾Ý·Ö³É¶à¸ö×ֶΡ£
ÏÂÃæÊÇÓÃÀ´¶ÁÈ¡CSVÎļþÄÚÈݵÄÀࣺ
package tip;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class ReadCSV {
public static void main(String[] args) {
try {
File csv = new File("C:\\writers.csv"); // CSVÎļþ
BufferedReader br = new BufferedReader(new FileReader(csv));
// ¶ÁÈ¡Ö±µ½×îºóÒ»ÐÐ
String line = "";
while ((line = br.readLine()) != null) {
// °ÑÒ»ÐÐÊý¾Ý·Ö¸î³É¶à¸ö×Ö¶Î
StringTokenizer st = new StringTokenizer(line, ",");
while (st.hasMoreTokens()) {
Ïà¹ØÎĵµ£º
ͨ³£µÄ¹ÛÄîÈÏΪ£¬ÊÂÎñ½öÓëÊý¾Ý¿âÏà¹Ø¡£
ÊÂÎñ±ØÐë·þ´ÓISO/IECËùÖƶ¨µÄACIDÔÔò¡£ACIDÊÇÔ×ÓÐÔ£¨atomicity£©¡¢Ò»ÖÂÐÔ£¨consistency£©¡¢¸ôÀëÐÔ
£¨isolation£©ºÍ³Ö¾ÃÐÔ£¨durability£©µÄËõд¡£ÊÂÎñµÄÔ×ÓÐÔ±íʾÊÂÎñÖ´Ðйý³ÌÖеÄÈκÎʧ°Ü¶¼½«µ¼ÖÂÊÂÎñËù×öµÄÈκÎÐÞ¸ÄʧЧ¡£Ò»ÖÂÐÔ±íʾ
µ±ÊÂÎñÖ´ÐÐʧ°Üʱ£¬ËùÓб»¸ÃÊÂÎñÓ°ÏìµÄÊý¾Ý ......
·´Éä»úÖÆ:ËùνµÄ·´Éä»úÖƾÍÊÇjava
ÓïÑÔÔÚÔËÐÐʱӵ
ÓÐÒ»Ïî×Ô¹ÛµÄÄÜÁ¦¡£Í¨¹ýÕâÖÖÄÜÁ¦¿ÉÒÔ³¹µ×µÄÁ˽â×ÔÉíµÄÇé¿öΪÏÂÒ»²½µÄ¶¯×÷×ö×¼±¸¡£ÏÂÃæ¾ßÌå½éÉÜÒ»ÏÂjava
µÄ·´Éä»úÖÆ¡£ÕâÀïÄ㽫µß¸²ÔÀ´¶ÔjavaµÄÀí½â¡£
JavaµÄ·´Éä»úÖƵÄʵÏÖÒª½èÖúÓÚ4¸öÀࣺclass£¬Constructor£¬Field£¬Method£»ÆäÖÐclass´ú±íµÄʱÀà¶Ô
Ïó£¬Constructo ......
Package µÄÃüÃû
Package µÄÃû×ÖÓ¦¸Ã¶¼ÊÇÓÉÒ»¸öСдµ¥´Ê×é³É¡£
Class µÄÃüÃû
Class µÄÃû×Ö±ØÐëÓÉ´óд×Öĸ¿ªÍ·¶øÆäËû×Öĸ¶¼Ð¡Ð´µÄµ¥´Ê×é³É
Class ±äÁ¿µÄÃüÃû
±äÁ¿µÄÃû×Ö±ØÐëÓÃÒ»¸öСд×Öĸ¿ªÍ·¡£ºóÃæµÄµ¥´ÊÓôóд×Öĸ¿ªÍ·¡£
Static Final&nbs ......
ÌáÆðJavaÄÚ²¿ÀࣨInner Class£©¿ÉÄܺܶàÈ˲»Ì«ÊìϤ£¬Êµ¼ÊÉÏÀàËƵĸÅÄîÔÚC++ÀïÒ²ÓУ¬ÄǾÍÊÇǶÌ×ÀࣨNested
Class£©£¬¹ØÓÚÕâÁ½ÕßµÄÇø±ðÓëÁªÏµ£¬ÔÚÏÂÎÄÖлáÓжԱȡ£ÄÚ²¿Àà´Ó±íÃæÉÏ¿´£¬¾ÍÊÇÔÚÀàÖÐÓÖ¶¨ÒåÁËÒ»¸öÀࣨÏÂÎĻῴµ½£¬ÄÚ²¿Àà¿ÉÒÔÔںܶàµØ·½¶¨Ò壩£¬¶øʵ
¼ÊÉϲ¢Ã»ÓÐÄÇô¼òµ¥£¬Õ§¿´ÉÏÈ¥ÄÚ²¿ÀàËƺõÓÐЩ¶àÓ࣬ËüµÄÓô¦¶ÔÓ ......