Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
325 views
in Technique[技术] by (71.8m points)

android - "In/out/inout" in a AIDL interface parameter value?

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.

What is the "out" in a AIDL interface parameter value?

Like this:

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.

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"?

Please help..

question from:https://stackoverflow.com/questions/4700225/in-out-inout-in-a-aidl-interface-parameter-value

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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);

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...