Browse Source

Implements Deserialization Logic

feature-serializer
fdai5728 3 years ago
parent
commit
f6e8fb03d3
  1. 24
      src/main/java/CredentialRepository.java

24
src/main/java/CredentialRepository.java

@ -1,4 +1,6 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
/**
@ -148,6 +150,28 @@ public class CredentialRepository implements CredentialRepositoryInterface{
}
}
/**
* Function to load serialized Objects from hard drive by path
* @param fileName
*/
public void deserializeObjects(String fileName)
{
if(fileName.equals("")) return;
try {
FileInputStream file = new FileInputStream(this.getWorkingDirectory() + fileName + ".claud11");
ObjectInputStream in = new ObjectInputStream(file);
this.credentials = (CredentialList)in.readObject();
in.close();
file.close();
} catch(Exception fail)
{
System.err.println("Loading of CredentialRepository failed");
}
}
/**
* helper function to check list size after insertion / deletion

Loading…
Cancel
Save