我正在从java中读取文本文件以插入到oracle DB表中,如何跳过前2行?
我想跳过文本文件中的前两行.
代码:
BufferdReader bReader = new BufferedReader (new FileReader(/home/test.txt));
String line = "";
while ((line = bReader.readLine ()) !=null)
{
if (line != null)
{
String[] array = line.split(",",-1) ;
for (String arrays : array ) {
System.out.println(arrays );
}
}
}
Run Code Online (Sandbox Code Playgroud)
在您之前添加while:
int ct = 0;
Run Code Online (Sandbox Code Playgroud)
而在此之前的第一次if上while:
if(ct < 2) {
ct++;
continue;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
46 次 |
| 最近记录: |