Java:PDFfiles和Textfile
我对PDFfiles进行了排序,其中包含一些包含名称的文件。 文本文件也有名称列表。 我试图做一个比较,但没有得到一个好的结果。 请看下面的片段,给我你的建议Java:PDFfiles和Textfile,java,Java,我对PDFfiles进行了排序,其中包含一些包含名称的文件。 文本文件也有名称列表。 我试图做一个比较,但没有得到一个好的结果。 请看下面的片段,给我你的建议 public static void main(String[] args) throws IOException { int j=0; int i=1; //reading text file*****************************************
public static void main(String[] args) throws IOException {
int j=0;
int i=1;
//reading text file*****************************************
File file = new File("E:/........../ NamesTextFile.txt");
List<String> names = new ArrayList<String>();
Scanner scan = new Scanner(file);
PDFManager pdfManager = new PDFManager();
while(scan.hasNextLine() && j!=100 ){
String name = scan.nextLine();
//if (!names.contains(name)) {
while (i<=7){
pdfManager.setFilePath("E:/........./PDFfilesTest/"+i+".pdf");
String pdfName=pdfManager.ToText();
if(pdfName.equals(name) && !names.contains(pdfName))
/*
keep reading PDFfilesTest until you receive a different name
in the sorted PDFfilesTest, store the name and compare it with
the NamesTextFile if it exists then continue reading
PDFfilesTest(for every name in)
*/
//eading PDF files reading****************************
names.add(name);
}
i++;
scan.close();
}
publicstaticvoidmain(字符串[]args)引发IOException{
int j=0;
int i=1;
//读取文本文件*****************************************
File File=新文件(“E:/……./NamesTextFile.txt”);
列表名称=新的ArrayList();
扫描仪扫描=新扫描仪(文件);
PDFManager PDFManager=新的PDFManager();
而(scan.hasNextLine()&&j!=100){
字符串名称=scan.nextLine();
//如果(!names.contains(name)){
而(iif((pdfManager.ToText().contains(name))){
System.out.println(pdfManager.ToText())
。
.
.
.从使用缩进正确格式化代码开始如何?谢谢您的输入!
}else if (!(pdfManager.ToText().contains(name))){
System.out.println("whatever");
..