List of utility methods to do Object Deserialize
T | deserialize(final byte[] data) Deserialize an object from the specified byte array and returns the result. try { final ByteArrayInputStream bas = new ByteArrayInputStream(data); final ObjectInputStream ois = new ObjectInputStream(bas); return (T) ois.readObject(); } catch (final Exception ex) { throw new IllegalStateException("Could not deserialize", ex); |
Object | deserialize(final byte[] data) deserialize ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(data); ObjectInputStream is = new ObjectInputStream(byteArrayInputStream); return is.readObject(); |
T | deserialize(final byte[] inBytes) Deserialize an object. final ByteArrayInputStream inputStream = new ByteArrayInputStream(inBytes); return deserialize(inputStream); |
Object | deserialize(final byte[] serialized) This method will accept a serialized version of any object defined in the system. final ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(serialized)); return ois.readObject(); |
V | deserializeFromByte(byte[] value) deserialize From Byte if (null == value || value.length <= 0) { return null; V reValue = null; ByteArrayInputStream bm = null; ObjectInputStream om = null; try { bm = new ByteArrayInputStream(value); ... |
Serializable | deserializeFromByteArray(byte[] bytes) deserialize From Byte Array ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes)); try { return deserializeFromStream(in); } finally { in.close(); |
Object | deserializeFromByteArray(byte[] encodedValue, String description) Deserializes an object from the given array of bytes, e.g., as serialized using #serializeToByteArray , and returns it. try { try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(encodedValue))) { return ois.readObject(); } catch (IOException | ClassNotFoundException exn) { throw new IllegalArgumentException("unable to deserialize " + description, exn); |
Object | deserializeFromByteArray(byte[] in) Utility method to deserialize Object from byte[]. Object object; try { ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(in)); try { object = ois.readObject(); } catch (ClassNotFoundException e) { throw new RuntimeException(e); ois.close(); } catch (IOException e) { throw new RuntimeException(e); return object; |
T | deserializeFromBytes(byte[] bytes, Class deserialize From Bytes ByteArrayInputStream byteStream = new ByteArrayInputStream(bytes); ObjectInputStream objectStream = new ObjectInputStream(byteStream); Object output = objectStream.readObject(); return clazz.cast(output); |
T | deserializeFromBytes(byte[] serialized, Class Deserialize a String obtained via #serializeIntoBytes(Serializable) into an object. try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(serialized))) { return clazz.cast(ois.readObject()); } catch (ClassNotFoundException e) { throw new IOException(e); |