Here you can find the source of deserialize(byte[] buffer, int count)
count
number of objects from it.
public static final Object[] deserialize(byte[] buffer, int count)
//package com.java2s; /*// w ww . j a v a2 s . c om * Copyright 2010 The Portico Project * * This file is part of portico. * * portico is free software; you can redistribute it and/or modify * it under the terms of the Common Developer and Distribution License (CDDL) * as published by Sun Microsystems. For more information see the LICENSE file. * * Use of this software is strictly AT YOUR OWN RISK!!! * If something bad happens you do not have permission to come crying to me. * (that goes for your lawyer as well) * */ import java.io.ByteArrayInputStream; import java.io.ObjectInputStream; public class Main { /** * This method takes the given buffer and extracts <code>count</code> number of objects * from it. These objects are returned in an array. */ public static final Object[] deserialize(byte[] buffer, int count) { try { Object[] objects = new Object[count]; ByteArrayInputStream bais = new ByteArrayInputStream(buffer); ObjectInputStream ois = new ObjectInputStream(bais); for (int i = 0; i < count; i++) objects[i] = ois.readObject(); ois.close(); return objects; } catch (Exception ex) { throw new RuntimeException(ex); } } }