This is how i insert binary data to a binary file:
-> fingerprint is a BitSet format
This is how i retrieve the binary data from the binary file:
-> fingerprint1 is also a BitSet format
However, i realised that the data inserted and the data retrieved is not the same. Can anyone tell why is the data different? Thanks~
-> fingerprint is a BitSet format
Code:
File binFile = new File("BinaryFp.txt");
FileOutputStream output = new FileOutputStream (binFile);
DataOutputStream data = new DataOutputStream (output);
for(int j=0,len=1024;j<len;j++)
{
boolean bit = fingerprint.get(j);
data.writeBoolean(bit);
}
-> fingerprint1 is also a BitSet format
Code:
FileInputStream input = new FileInputStream ("BinaryFp.txt");
DataInputStream data = new DataInputStream (input);
for(int j=0;j<1024;j++)
{
boolean bit = data.readBoolean();
fingerprint1.set(j,bit);
}