/** * @param bytes Bytes array. * @return Portable object. * @throws org.apache.ignite.binary.BinaryObjectException In case of error. */ @SuppressWarnings("unchecked") @Nullable public <T> T unmarshal(byte[] bytes, @Nullable ClassLoader clsLdr) throws BinaryObjectException { assert bytes != null; return (T) PortableUtils.unmarshal(PortableHeapInputStream.create(bytes, 0), ctx, clsLdr); }
/** * @param arr Byte array. * @param ldr Class loader. * @return Deserialized object. * @throws org.apache.ignite.binary.BinaryObjectException In case of error. */ @SuppressWarnings("unchecked") @Nullable public <T> T deserialize(byte[] arr, @Nullable ClassLoader ldr) throws BinaryObjectException { assert arr != null; assert arr.length > 0; if (arr[0] == NULL) return null; return (T) new BinaryReaderExImpl(ctx, PortableHeapInputStream.create(arr, 0), ldr).deserialize(); }