自 2026 年起,为了与我们的主干稳定开发模型保持一致,并确保生态系统的平台稳定性,我们将在第 2 季度和第 4 季度向 AOSP 发布源代码。如需构建 AOSP 并为其贡献代码,请使用 android-latest-release。android-latest-release 清单分支将始终引用推送到 AOSP 的最新版本。如需了解详情,请参阅 AOSP 变更。
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
CollectingOutputReceiver
public
class
CollectingOutputReceiver
extends Object
implements
IShellOutputReceiver
| java.lang.Object
|
| ↳ |
com.android.ddmlib.CollectingOutputReceiver
|
一种 IShellOutputReceiver,用于将整个 shell 输出收集到一个 String 中。
摘要
公共构造函数
CollectingOutputReceiver
public CollectingOutputReceiver ()
CollectingOutputReceiver
public CollectingOutputReceiver (CountDownLatch commandCompleteLatch)
| 参数 |
commandCompleteLatch |
CountDownLatch |
公共方法
addOutput
public void addOutput (byte[] data,
int offset,
int length)
每次有新数据可用时调用。
| 参数 |
data |
byte:新数据。 |
offset |
int:新数据的起始偏移量。 |
length |
int:新数据的长度。 |
awaitCompletion
public boolean awaitCompletion (long timeout,
TimeUnit unit)
| 参数 |
timeout |
long |
unit |
TimeUnit |
取消
public void cancel ()
取消输出集合。
flush
public void flush ()
在进程执行结束时调用(除非进程已取消)。这允许接收方终止并刷新尚未处理的任何数据。
getOutput
public String getOutput ()
isCancelled
public boolean isCancelled ()
用于停止执行远程 shell 命令的取消方法。
| 返回 |
boolean |
如果为 true,则取消命令的执行。 |
isComplete
public boolean isComplete ()
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2026-06-22。
[null,null,["最后更新时间 (UTC):2026-06-22。"],[],[]]