getOutputData method

Uint8List getOutputData()

Gets the the external resource data as a byte array.

return The external resource data as a byte array. throws BiosealException An error has occurred during Bioseal Library execution.

Implementation

Uint8List getOutputData() {
  Pointer<UnsignedChar> pOutputData = nullptr;
  Pointer<Int> pOutputDataSize = calloc();
  pOutputDataSize[0] = -1;
  try {
    var err = biosealSDK.id3BiosealResourceCallbackArgs_GetOutputData(_pHandle.value, pOutputData, pOutputDataSize);
    if (err == BiosealError.insufficientBuffer.value) {
      pOutputData = calloc.allocate(pOutputDataSize.value);
      err = biosealSDK.id3BiosealResourceCallbackArgs_GetOutputData(_pHandle.value, pOutputData, pOutputDataSize);
    }
    if (err != BiosealError.success.value) {
      throw BiosealException(err);
    }
    final vOutputData = Uint8List.fromList(pOutputData.cast<Uint8>().asTypedList(pOutputDataSize.value));
    return vOutputData;
  } finally {
    calloc.free(pOutputData);
    calloc.free(pOutputDataSize);
  }
}