Here you can find the source of deserialize(byte[] bytes)
public static Object deserialize(byte[] bytes) throws IOException
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); you may not import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.util.zip.Inflater; import java.util.zip.InflaterInputStream; public class Main { private static final int ZLIB_COMPRESSION = 1; public static Object deserialize(byte[] bytes) throws IOException { if (bytes.length < 2) { throw new IOException("Invalid bytes content"); }/*w w w. ja v a 2s.c o m*/ InputStream in = new ByteArrayInputStream(bytes); if (bytes[0] == 0) { in.read(); // consume the marker; if (in.read() != ZLIB_COMPRESSION) { throw new IOException("Unknown compression type"); } final Inflater inflater = new Inflater(true); in = new InflaterInputStream(in, inflater) { @Override public void close() throws IOException { try { super.close(); } finally { inflater.end(); } } }; } try (ObjectInputStream oin = new ObjectInputStream(in)) { try { return oin.readObject(); } catch (ClassNotFoundException e) { throw new IOException("Exception while deserilaizing.", e); } } } }