I am writing an object to a file. The object is basically a data chunk from a file, with some other information added. The thing I don't understand is that the input file is around 10 KB, but the output file is about 20 KB, but data I add one only a few bytes.
What could be the reason? Are there some object identifiers, attributes also logged and occupy some space apart from the data chunk.
Code Snippet:
public void writePacket(Packet packet) {
String fileName = packet.getName();
String filePath = dtnStore+fileName ;
ObjectOutputStream out = null;
File file = new File(filePath);
if(!file.exists())
out = new ObjectOutputStream(new FileOutputStream (filePath));
else
out = new AppendableObjectOutputStream (new FileOutputStream (filePath, true));
out.writeObject(packet);
out.flush ();
}