If I write my code like this, it gives an error "File not found access denied ......"
public class ImplRegistration implements IRegistration {
@Override
public boolean newRegistration(Registration_BE reg_be) {
FileOutputStream fos = new FileOutputStream("serial.ser");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(reg_be);
}
}
For security reasons, I changed the fourth line of the code to this:
FileOutputStream fos = new FileOutputStream("f://serial.ser");
But then it showed the exception java.io.NotSerializableException: java.io.ByteArrayInputStream
.
How can I serialize the object?