import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class FilterText {
public static void main(String s[]) throws IOException {
String line = null;
List<String> modelsList = new ArrayList<String>();
File directory = new File("C:\\Users\\vp0c42452\\Desktop\\texts\\text");
if (directory.isDirectory()) {
for (int x = 0; x < directory.listFiles().length; x++) {
FileInputStream in = new FileInputStream(
directory.listFiles()[x]);
InputStreamReader inputStreamReader = new InputStreamReader(in);
BufferedReader reader = new BufferedReader(inputStreamReader);
String[] splitArray = null;
while (((line = reader.readLine()) != null)) {
splitArray = line.split(",");
String sss = null;
for (int i = 0; i < splitArray.length; i++) {
if (splitArray[i].contains("modelNum")) {
String[] ss = splitArray[i].split(":");
// for (int j = 0; j < ss.length; j++) {
sss = ss[1].substring(ss[1].indexOf("\"") + 1,
ss[1].lastIndexOf("\""));
// }
if (sss != null && !modelsList.contains(sss))
modelsList.add(sss);
}
}
}
}
}
System.out.println(modelsList);
}
}
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
public class FilterText {
public static void main(String s[]) throws IOException {
String line = null;
List<String> modelsList = new ArrayList<String>();
File directory = new File("C:\\Users\\vp0c42452\\Desktop\\texts\\text");
if (directory.isDirectory()) {
for (int x = 0; x < directory.listFiles().length; x++) {
FileInputStream in = new FileInputStream(
directory.listFiles()[x]);
InputStreamReader inputStreamReader = new InputStreamReader(in);
BufferedReader reader = new BufferedReader(inputStreamReader);
String[] splitArray = null;
while (((line = reader.readLine()) != null)) {
splitArray = line.split(",");
String sss = null;
for (int i = 0; i < splitArray.length; i++) {
if (splitArray[i].contains("modelNum")) {
String[] ss = splitArray[i].split(":");
// for (int j = 0; j < ss.length; j++) {
sss = ss[1].substring(ss[1].indexOf("\"") + 1,
ss[1].lastIndexOf("\""));
// }
if (sss != null && !modelsList.contains(sss))
modelsList.add(sss);
}
}
}
}
}
System.out.println(modelsList);
}
}
No comments:
Post a Comment