package imageChecker;
import java.io.*;
public class imageChecker
{
public static void main(String args[]) throws IOException
{
FileReader oldFile = new FileReader("C:\\Users\\Matthew\\Desktop\\New folder\\old.xml");
BufferedReader oldFileIn = new BufferedReader(oldFile);
FileReader newFile = new FileReader("C:\\Users\\Matthew\\Desktop\\New folder\\new.xml");
BufferedReader newFileIn = new BufferedReader(newFile);
FileWriter fileOld = new FileWriter("C:\\Users\\Matthew\\Desktop\\New folder\\oldItems.txt");
BufferedWriter fileOldOut = new BufferedWriter(fileOld);
FileWriter fileNew = new FileWriter("C:\\Users\\Matthew\\Desktop\\New folder\\newItems.txt");
BufferedWriter fileNewOut = new BufferedWriter(fileNew);
//only take the part of the code at the bottom of the files that have the image hashes
int startAtOld = 199674;
int stopAtOld = 220913;
for(int i = 0; i < stopAtOld; i++)
{
String oldLine = oldFileIn.readLine();
if(i >= startAtOld)
{
fileOldOut.write(oldLine + "\r");
fileOldOut.flush();
}
}
//only take the part of the code at the bottom of the files that have the image hashes
int startAtNew = 200566;
int stopAtNew = 221847;
for(int i = 0; i < stopAtNew; i++)
{
String oldLine = newFileIn.readLine();
if(i >= startAtNew)
{
fileNewOut.write(oldLine + "\r");
fileNewOut.flush();
}
}
//reset the file readers to use the snipped codes obtained above that lists only the images
oldFile = new FileReader("C:\\Users\\Matthew\\Desktop\\New folder\\oldItems.txt");
oldFileIn = new BufferedReader(oldFile);
newFile = new FileReader("C:\\Users\\Matthew\\Desktop\\New folder\\newItems.txt");
newFileIn = new BufferedReader(newFile);
//setup the writer to output only the differences between the files above
FileWriter diffs = new FileWriter("C:\\Users\\Matthew\\Desktop\\New folder\\diffs.txt");
BufferedWriter diffsOut = new BufferedWriter(diffs);
//compare the old files
String newLine = newFileIn.readLine();
boolean found = false;
while(newLine != null)
{
oldFile = new FileReader("C:\\Users\\Matthew\\Desktop\\New folder\\oldItems.txt");
oldFileIn = new BufferedReader(oldFile);
String oldLine = oldFileIn.readLine();
while(oldLine != null && !found)
{
if(newLine.equals(oldLine))
{
found = true;
}
oldLine = oldFileIn.readLine();
}
if(!found)
{
diffsOut.write(newLine + "\r");
diffsOut.flush();
System.out.println(newLine);
}
found = false;
newLine = newFileIn.readLine();
}
diffsOut.close();
}
}
import java.io.*;
public class imageChecker
{
public static void main(String args[]) throws IOException
{
FileReader oldFile = new FileReader("C:\\Users\\Matthew\\Desktop\\New folder\\old.xml");
BufferedReader oldFileIn = new BufferedReader(oldFile);
FileReader newFile = new FileReader("C:\\Users\\Matthew\\Desktop\\New folder\\new.xml");
BufferedReader newFileIn = new BufferedReader(newFile);
FileWriter fileOld = new FileWriter("C:\\Users\\Matthew\\Desktop\\New folder\\oldItems.txt");
BufferedWriter fileOldOut = new BufferedWriter(fileOld);
FileWriter fileNew = new FileWriter("C:\\Users\\Matthew\\Desktop\\New folder\\newItems.txt");
BufferedWriter fileNewOut = new BufferedWriter(fileNew);
//only take the part of the code at the bottom of the files that have the image hashes
int startAtOld = 199674;
int stopAtOld = 220913;
for(int i = 0; i < stopAtOld; i++)
{
String oldLine = oldFileIn.readLine();
if(i >= startAtOld)
{
fileOldOut.write(oldLine + "\r");
fileOldOut.flush();
}
}
//only take the part of the code at the bottom of the files that have the image hashes
int startAtNew = 200566;
int stopAtNew = 221847;
for(int i = 0; i < stopAtNew; i++)
{
String oldLine = newFileIn.readLine();
if(i >= startAtNew)
{
fileNewOut.write(oldLine + "\r");
fileNewOut.flush();
}
}
//reset the file readers to use the snipped codes obtained above that lists only the images
oldFile = new FileReader("C:\\Users\\Matthew\\Desktop\\New folder\\oldItems.txt");
oldFileIn = new BufferedReader(oldFile);
newFile = new FileReader("C:\\Users\\Matthew\\Desktop\\New folder\\newItems.txt");
newFileIn = new BufferedReader(newFile);
//setup the writer to output only the differences between the files above
FileWriter diffs = new FileWriter("C:\\Users\\Matthew\\Desktop\\New folder\\diffs.txt");
BufferedWriter diffsOut = new BufferedWriter(diffs);
//compare the old files
String newLine = newFileIn.readLine();
boolean found = false;
while(newLine != null)
{
oldFile = new FileReader("C:\\Users\\Matthew\\Desktop\\New folder\\oldItems.txt");
oldFileIn = new BufferedReader(oldFile);
String oldLine = oldFileIn.readLine();
while(oldLine != null && !found)
{
if(newLine.equals(oldLine))
{
found = true;
}
oldLine = oldFileIn.readLine();
}
if(!found)
{
diffsOut.write(newLine + "\r");
diffsOut.flush();
System.out.println(newLine);
}
found = false;
newLine = newFileIn.readLine();
}
diffsOut.close();
}
}




