如何使用 logcat 以本机代码打印(或转储)包裹

How can I print(or dump) a Parcel in native code, use logcat?

本文关键字:转储 包裹 打印 何使用 logcat 本机代码      更新时间:2023-10-16

我们知道 android 在 c++ 和 java 中都有一个类 Parcel,现在我需要使用 logcat 来监视本机代码中的 parcel 对象,如下所示:

Parcel p;
p.writeInt32(...);
p.writeInt32(...);
...
// need to log parcel data here
LOGD(...);

我该怎么做?我发现Parcel有一个成员函数print(TextOutput&to,uint32_t标志),但我不知道用法...请帮帮我!!

Parcel

有一个 marshall() 方法,该方法返回 Parcel 内容的字节数组。