code: public static Data toHeapData(Data data) {
          if (data == null || data instanceof HeapData) {
              return data;
          }
          return new HeapData(data.toByteArray());
      }
docs: Converts Data to HeapData. Useful for offheap conversion.
  
  @param data
  @return the onheap representation of data. If data is null, null is returned.