Stan James thanks you first
the content of file is unzip form a zip package,the problem is how to seperte three part by blank line ,put them into different List .
the follow is my program, the problem is I don't know the number of blank line between two part.
public static void unzipFile(File file_input, File dir_output) {
ZipInputStream zip_in_stream = null;
ZipEntry zip_entry = null;
try {
FileInputStream in = new FileInputStream(file_input);
BufferedInputStream source = new BufferedInputStream(in);
zip_in_stream = new ZipInputStream(source);
}
catch (IOException e) {
e.printStackTrace();
}
try {
int blockCount = 0;
while ((zip_entry = zip_in_stream.getNextEntry()) != null) {
try {
zip_entry.getName();
BufferedReader reader = new BufferedReader(new InputStreamReader(zip_in_stream));
String line;
while ((line = reader.readLine()) != null) {
if (line.length() == 0) {
blockCount++;
System.out.println(line);
continue;
}
if (blockCount == 0) {
headList.add(line);
}
if (blockCount == 1) {
productStaticList.add(line);
}
if (blockCount == 2) {
detailList.add(line);
}
System.out.println(line);
}
}
catch (IOException e) {
e.printStackTrace();
}
zip_in_stream.closeEntry();
}
zip_in_stream.close();
}
catch (IOException e) {
e.printStackTrace();
}
}
%CDM-ORS
SMS: 胜利油田
CODE: 05460002
DATE: 2006-08-29
30104 307
30100 196
30103 185
30108 1
TFCA 8054602122000251 30104
TFCA 8054602122000368 30100
TFCA 8054602122000426 30103 30104
TFCA 8054602122000616 30100 30104
TFCA 8054602122000731 30100 30104
TFCA 8054602122000988 30103
TFCA 8054602122001085 30103 30104
TFCA 8054602122001192 30100