Ejemplo n.º 1
0
  /**
   * @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);
  }
Ejemplo n.º 2
0
  /**
   * @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();
  }