wilian 2016-04-06 13:23:05 +00:00
parent 0f119c95c1
commit c8aedee277
1 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,48 @@
package com.rjconsultores.ventaboletos.utilerias;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class ValidadorImportacaoEcf {
public static void main(String[] args) {
BufferedReader br;
try {
br = new BufferedReader(new FileReader("c:\\Users\\Wilian\\Downloads\\fiscal_201604050547.txt"));
try {
int linha = 1;
String line = br.readLine();
Integer l1 = null;
Integer l2 = null;
while (line != null) {
if(line.startsWith("1")) {
l1 = Integer.valueOf(line.substring(51, 65));
l2 = 0;
}
if(line.startsWith("2")) {
l2 += Integer.valueOf(line.substring(47, 62));
}
line = br.readLine();
if(line.startsWith("1") && l1 != null && l2 != null) {
if(l1.compareTo(l2) != 0) {
System.out.println("Linha: " + linha);
}
}
linha++;
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
} catch (FileNotFoundException e) {
}
}
}