標題:
檔案與串流(二) 讀取 csv格式
[打印本頁]
作者:
周政輝
時間:
2018-6-23 10:41
標題:
檔案與串流(二) 讀取 csv格式
[attach]4265[/attach]
作者:
蔡季樺
時間:
2018-6-23 11:05
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
public class Main {
public static void main(String[] args) throws IOException, FileNotFoundException {
InputStreamReader isr = new InputStreamReader(new FileInputStream("C:\\eclipse\\workspace\\D20180623\\src\\2.csv"),"UTF-8");
BufferedReader br = new BufferedReader(isr);
while(br.ready())
{
System.out.println(br.readLine());
}
isr.close();
}
複製代碼
作者:
蔡庭豪
時間:
2018-6-23 11:09
package bbs.istak.org.tw;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
// TODO 自動產生的方法 Stub
InputStreamReader isr = new InputStreamReader(new FileInputStream("D:\\frank\\CSV\\src\\bbs\\istak\\org\\tw\\2.csv"),"UTF-8");
BufferedReader bf = new BufferedReader(isr);
while(bf.ready()){
System.out.println(bf.readLine());
}
isr.close();
}
}
複製代碼
作者:
陳泓瑜
時間:
2018-6-23 11:14
本帖最後由 陳泓瑜 於 2018-6-23 11:34 編輯
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
public class Main {
public static void main(String[] args) throws IOException{
InputStreamReader isr = new InputStreamReader(new FileInputStream("C:\\Users\\student\\Downloads\\2.csv"),"UTF-8");
BufferedReader br = new BufferedReader(isr);
while(br.ready())
{
System.out.println(br.readLine());
}
isr.close();
}
複製代碼
作者:
張健勳
時間:
2018-6-23 11:15
package bbs.istak.org.tw;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
public class Main {
public static void main(String[] args) throws IOException, FileNotFoundException {
InputStreamReader isr = new InputStreamReader(new FileInputStream("D:\\15LiveTW\\eclipse\\wp2\\D20180623\\src\\bbs\\istak\\org\\tw\\2.csv"),"UTF-8");
BufferedReader br = new BufferedReader(isr);
while(br.ready())
{
System.out.println(br.readLine());
}
isr.close();
}
}
複製代碼
作者:
黃茂勛
時間:
2018-7-2 16:13
package bbs.istak.org.tw;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
public class haung20180702 {
public static void main(String[] args) {
File file = new File("C:/a/b/c/2.csv");
BufferedReader br;
try {
br = new BufferedReader(new InputStreamReader(new FileInputStream(file.getAbsolutePath()),"UTF-8"));
while(br.ready())
{
System.out.println(br.readLine());
}
br.close();
} catch (Exception e) {}
}
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2