List of utility methods to do Object Deserialize
T | deserializeObject(byte[] data, Class deserialize Object return deserializeObject(new ByteArrayInputStream(data), clazz); |
T | deserializeObject(byte[] obj) Deserializes an object from its byte format. try (ByteArrayInputStream in = new ByteArrayInputStream(obj)) { try (ObjectInputStream r = new ObjectInputStream(in)) { return (T) r.readObject(); |
Object | deserializeObject(byte[] serializedObj) Deserializes Object from byte array. InputStream is = new ByteArrayInputStream(serializedObj); ObjectInput oi; oi = new ObjectInputStream(is); return oi.readObject(); |
Object | deserializeObject(File file) This method deserializes an object from an input stream. FileInputStream fis = new FileInputStream(file); Object object = null; try { ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(fis)); object = ois.readObject(); } finally { fis.close(); return object; |
T | deserializeObject(File inFile) deserialize Object return deserializeObject(new FileInputStream(inFile), true); |
T | deserializeObject(final byte[] b) Serializes an object in memory. try { final ByteArrayInputStream bin = new ByteArrayInputStream(b); final ObjectInputStream cin = new ObjectInputStream(bin); return (T) cin.readObject(); } catch (ClassNotFoundException | IOException e) { e.printStackTrace(); return null; ... |
Object | deserializeObject(final byte[] bytes) deserialize Object ObjectInputStream in = null; Object obj = null; if (bytes == null) { return null; try { in = new ObjectInputStream(new ByteArrayInputStream(bytes)); obj = in.readObject(); ... |
Object | deserializeToObject(byte[] bytes) deserialize To Object try { ByteArrayInputStream bos = new ByteArrayInputStream(bytes); ObjectInputStream objectInputStream = new ObjectInputStream(bos); Object readObject = objectInputStream.readObject(); objectInputStream.close(); return readObject; } catch (Exception e) { throw new RuntimeException("Exception trying to deserialize bytes to obj, bytes=" + new String(bytes), ... |