[英]I am reading the text file from java to insert into oracle DB table, how can skip first 2 lines?
I am reading the text file from java to insert into oracle DB table, how can skip first 2 lines? 我正在从Java读取文本文件以插入到Oracle DB表中,如何跳过前2行?
I want to skip the first 2 lines from text file. 我想跳过文本文件的前2行。
Code : 代码:
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 );
}
}
}
Add this before your while
: 您之前添加此while
:
int ct = 0;
And this before the first if
on the while
: 而在此之前,第一if
在while
:
if(ct < 2) {
ct++;
continue;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.