// DataInputStream dins = new DataInputStream(bins);
try {
ObjectInputStream ois = new ObjectInputStream(bins);
AbstractTool tool = (AbstractTool) ois.readObject();
// Apply the tool to the local canvas.
tool.draw(canvas);
tools.add(tool);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (ClassNotFoundException e) {