@SuppressWarnings("unchecked")
  public static <T extends Serializable> T deserialize(byte[] array, boolean useContextClassLoader)
    throws IOException, ClassNotFoundException {
    """
	This is the opposite of {@link #serialize(Serializable)}.
	
	@param array the previously serialized object
	@param useContextClassLoader true to use the context classLoader, false
	to use the current classLoader
	@exception IOException if there is a problem in the deserialization step
	@exception ClassNotFoundException if problem with the serialized object
    """
    ByteArrayInputStream bais = new ByteArrayInputStream(array);
    ObjectInputStream ois;

    if (useContextClassLoader)
    {
      ois = new ObjectInputStreamWithClassLoader(bais, null);
    }
    else
    {
      ois = new ObjectInputStream(bais);
    }

    try
    {
      return (T) ois.readObject();
    }
    finally
    {
      ois.close();
    }
  }
@SuppressWarnings("unchecked")
  public static <T extends Serializable> T deserialize(byte[] array, boolean useContextClassLoader)
    throws IOException, ClassNotFoundException
  {
    ByteArrayInputStream bais = new ByteArrayInputStream(array);
    ObjectInputStream ois;

    if (useContextClassLoader)
    {
      ois = new ObjectInputStreamWithClassLoader(bais, null);
    }
    else
    {
      ois = new ObjectInputStream(bais);
    }

    try
    {
      return (T) ois.readObject();
    }
    finally
    {
      ois.close();
    }
  }
@ SuppressWarnings ( "unchecked" ) public static < T extends Serializable > T deserialize ( byte [ ] array , boolean useContextClassLoader ) throws IOException , ClassNotFoundException { ByteArrayInputStream bais = new ByteArrayInputStream ( array ) ; ObjectInputStream ois ; if ( useContextClassLoader ) { ois = new ObjectInputStreamWithClassLoader ( bais , null ) ; } else { ois = new ObjectInputStream ( bais ) ; } try { return ( T ) ois . readObject ( ) ; } finally { ois . close ( ) ; } }
This is the opposite of {@link #serialize(Serializable)}.

@param array the previously serialized object
@param useContextClassLoader true to use the context classLoader, false
to use the current classLoader
@exception IOException if there is a problem in the deserialization step
@exception ClassNotFoundException if problem with the serialized object
This is the opposite of { @link #serialize ( Serializable ) } .