List of utility methods to do Byte Array to Object
Serializable | deserialize(byte[] bytes) Deserializes the object from byte array try (ByteArrayInputStream b = new ByteArrayInputStream(bytes)) { try (ObjectInputStream o = new ObjectInputStream(b)) { return (Serializable) o.readObject(); |
Object | deserialize(byte[] bytes) deserialize ByteArrayInputStream in = new ByteArrayInputStream(bytes); ObjectInputStream is = new ObjectInputStream(in); return is.readObject(); |
T | deserialize(byte[] bytes) deserialize try (ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes))) { return (T) in.readObject(); |
Object | deserialize(byte[] bytes) deserialize ByteArrayInputStream bis = null; ObjectInputStream ois = null; try { bis = new ByteArrayInputStream(bytes); ois = new ObjectInputStream(bis); return ois.readObject(); } catch (IOException e) { throw new RuntimeException("Error when deserialize object"); ... |
K | deserialize(byte[] bytes) De-serialize a byte array back to it's original object. try { ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream); @SuppressWarnings("unchecked") final K k = (K) objectInputStream.readObject(); return k; } catch (IOException e) { throw new RuntimeException(e); ... |
Object | deserialize(byte[] bytes) deserialize if (bytes.length < 2) { throw new IOException("Invalid bytes content"); InputStream in = new ByteArrayInputStream(bytes); if (bytes[0] == 0) { in.read(); if (in.read() != ZLIB_COMPRESSION) { throw new IOException("Unknown compression type"); ... |
Object | deserialize(byte[] bytes) deserialize ByteArrayInputStream bais = null; try { bais = new ByteArrayInputStream(bytes); ObjectInputStream ois = new ObjectInputStream(bais); return ois.readObject(); } catch (Exception e) { return null; ... |
Object | deserialize(byte[] bytes) Deserialize. if (bytes == null) return null; ByteArrayInputStream is = new ByteArrayInputStream(bytes); ObjectInputStream in = new ObjectInputStream(is); Object obj = in.readObject(); in.close(); return obj; |
Object | deserialize(byte[] bytes) deserialize if (bytes == null) { return null; ByteArrayInputStream b = new ByteArrayInputStream(bytes); ObjectInputStream o; try { o = new ObjectInputStream(b); return o.readObject(); ... |
Object | deserialize(byte[] bytes) Deserialize the byte array into an object. if (bytes == null) { return null; try { ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes)); return ois.readObject(); } catch (IOException ex) { throw new IllegalArgumentException("Failed to deserialize object", ex); ... |