+ -
当前位置:首页 → 问答吧 → 怎么将readline的资料存入array 中?

怎么将readline的资料存入array 中?

时间:2011-12-15

来源:互联网

各位大大,
这是readline的讯息,
cust place c1 c2 c3 c4 c5
steve tai 17 53037 53 72 1
tome hsi 17 22087 24227 66 1
jay tai 6 16709 80 200 5
......

请问要怎么将每一行讯息存入array 中?

作者: stefansaye   发布时间: 2011-12-15

stefansaye wrote:
各位大大,
这是readline的讯息,
cust place c1 c2 c3 c4 c5
steve tai 17 53037 53 72 1
tome hsi 17 22087 24227 66 1
jay tai 6 16709 80 200 5
......

请问要怎么将每一行讯息存入array 中?


1
2
3
4
5
6
7
8
ArrayList<String> a = new ArrayList<String>();
BufferedInputStream in = new BufferedInputStream();
 
String data = null;
 
while(!(data=in.readline()).equals("")) { a.add(data);
} 


判断读到结尾那边我有点忘了 你可能要 try一下@@

作者: Saber_Servant   发布时间: 2011-12-16