Serialization and archiving object
<p>I need to do the same operation but in one stream. May you help me, please?</p>

<pre><code>public static byte[] archivingAndSerialization(Object object){

  ByteArrayOutputStream serializationByteArray = new ByteArrayOutputStream();
  ByteArrayOutputStream archvingByteArray = new ByteArrayOutputStream();
  try {

     ObjectOutputStream byteStream = new ObjectOutputStream(serializationByteArray);
     byteStream.writeObject(object);
     ZipOutputStream out = new ZipOutputStream(archvingByteArray);
     out.putNextEntry(new ZipEntry("str"));
     out.write(serializationByteArray.toByteArray());
     out.flush();
     out.close();

     } catch (IOException e) {
logger.error("Error while IOException!", e);
     }
  return archvingByteArray.toByteArray();
}
</code></pre>
