I have a dummy Java Program, which I want to write in Clojure. It has a class which implements Serializable and a function which saves it. Since I have never written such programs in Clojure, I wanted to know what would be the correct way to approach this problem, what Clojure data structures, and api calls would you use?
import java. io. *;
public class Box implements Serializable
{
private int width; private int height;
public void setWidth(int w)
{ width =w;}
public void setHeight(int h)
{height = h;}
}
public static void main (String[] args)
{
Box myBox =new Box();
myBox.setWidth(50);
myBox.setHeight(20) ;
try {
FileoutputStream fs = new File("foo.ser");
ObjectOUtputStream os = new ObjectOutputStream(fs);
os.writeObject(myBox);
os . close () ;
} catch (Exception ex) {} }