int serialBytesLength = dis.readInt();
byte[] serialBytes = new byte[serialBytesLength];
dis.readFully(serialBytes);
String serialNumber = new String(serialBytes, "US-ASCII");
Bunny bunny = new Bunny(serialNumber);
// Reading bunny name
int nameBytesLength = dis.readInt();
byte[] nameBytes = new byte[nameBytesLength];
dis.readFully(nameBytes);
bunny.setName(new String(nameBytes, "US-ASCII"));
// Reading ping interval
bunny.setPingInterval(dis.readInt());
// Reading plugins count
int pluginCount = dis.readInt();
for (int i = 0; i < pluginCount; i++)
{
// Reading plugin
AbstractPlugin plugin = null;
try
{
plugin = this.readPluginFromInputStream(dis, pluginFactory);
}
catch (PluginCreationException e)
{
continue;
}
// Adding plugin
plugin.setBunny(bunny);
bunny.addPlugin(plugin);
}
return bunny;
}