Referenz: http://tristan1.iteye.com/blo...
public void testDeserialize() throws IOException, ClassNotFoundException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); BigInteger bi = new BigInteger("0"); oos.writeObject(bi); byte[] str = baos.toByteArray(); ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(new ByteArrayInputStream(str))); Object obj = ois.readObject(); assertNotNull(obj); assertEquals(obj.getClass().getName(),"java.math.BigInteger"); assertEquals(((BigInteger)obj).intValue(), 0); }
Schlüsselverarbeitung
byte[] str = baos.toByteArray();