"在输入/输出/ INOUT"在AIDL接口的参数值? [英] "In/out/inout" in a AIDL interface parameter value?
问题描述
我编程的无线流媒体应用程序。我用AIDL接口技术与服务通信运行电台播放作为远程服务。但我真的不明白了一件事。
I'm programming a radio streaming app. I run the "radio playing" as a remote Service by using AIDL interface technique to communicate with the Service. But I don't really understand one thing.
什么是一个AIDL接口参数值的走出去?
What is the "out" in a AIDL interface parameter value?
这样的:
String doSomething(in String a, out String[] b);
我中的理解,就是将数据发送到远程的时候,方法是从活动的调用。
I understand "in", that is sending data to the remote when the method is called from activity.
什么是出,为什么我们需要来和走出去中相同的方法?在这种情况下,他们在(出/ INOUT)使用?为什么的String []
去?
What is the "out", and why we need "in" and "out" in same method? In which case are they("out/inout") used? Why is the String[]
"out"?
请帮助..
推荐答案
在 AIDL ,在从标记指定一个只输出参数。换句话说,这是一个包含对输入不感兴趣的数据的参数,但该方法在将充满数据
In AIDL, the "out" tag specifies an output-only parameter. In other words, it's a parameter that contains no interesting data on input, but will be filled with data during the method.
例如,那份字节数组可能会喜欢这个指定的方法:
For example, a method that copies an array of bytes might be specified like this:
void copyArray(in byte[] source, out byte[] dest);
在INOUT标签表示该参数才有意义上的输入和输出。例如:
The "inout" tag indicates that the parameter has meaning on both input and output. For example:
void charsToUpper(inout char[] chars);
这是因为每一个参数的内容必须整理(序列化,传播是很重要的,收到的,和反序列化)。输入/输出标签允许活页夹跳过获得更好的性能编组的一步。
This is important because the contents of every parameter must be marshalled (serialized, transmitted, received, and deserialized). The in/out tags allow the Binder to skip the marshalling step for better performance.
这篇关于"在输入/输出/ INOUT"在AIDL接口的参数值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!