优惠码 第80页

鸿蒙OS MessageParcel

MessageParcel java.lang.Object |—ohos.utils.Parcel |—|—ohos.rpc.MessageParcel public class MessageParcel extends Parcel 继承自 Parcel 类并提供管理 MessageParcel 对象的方法。 此类提供读写对象、接口令牌、文件描述符和大数据的方法。 方法总结 修饰符和类型 方法 描述 static void closeFileDescriptor(FileDescriptor descriptor) 禁用 MessageParcel 中的文件描述符。 boolean containFileDescriptors() 检查此 MessageParcel 对象是否包含文件描述符。 static MessageParcel create() 创建一个 MessageParcel 对象。 static MessageParcel create(long object) 创建具有给定指针的 MessageParcel 对象。 IRemoteObject[] createRemoteObjectArray() 创建一个 IRemoteObject 对象数组。 ListIRemoteObject createRemoteObjectList() 创建 IRemoteObject 对象的列表。 static int detachFd(FileDescriptor fileDescriptor) 从 FileDescriptor 中分离本机 fd。 static FileDescriptor dupFileDescriptor(FileDescriptor descriptor) 获得一个新的文件描述符,它是现有文件描述符的副本。 protected void finalize() 当垃圾收集确定不再有对该对象的引用时,由对象上的垃圾收集器调用。 int getDataVersion() 从 MessageParcel 对象返回数据版本。 static int getFd(FileDescriptor fileDescriptor) 从 FileDescriptor 读取本机 fd static FileDescriptor getFdFromDatagramSocket(DatagramSocket datagramSocket) 从 DatagramSocket 读取 FileDescriptor int getRawDataCapacity() 获取 MessageParcel 可以容纳的最大原始数据量。 static MessageParcel obtain() 创建一个 MessageParcel 对象。 static MessageParcel obtain(long object) 获取具有给定指针的 MessageParcel 对象。 Ashmem readAshmem() 从此 MessageParcel 中读取 Ashmem 对象。 void readException() 从 MessageParcel 中读取异常。 FileDescriptor readFileDescriptor() 从 MessageParcel 读取文件描述符。 String readInterfaceToken() 从 MessageParcel 读取接口令牌。 byte[] readRawData(int size) 从 MessageParcel 读取原始数据。 IRemoteObject readRemoteObject() 从 MessageParcel 读取远程对象。 void readRemoteObjectArray(IRemoteObject[] objects) 从 MessageParcel 中读取一组 IRemoteObject 对象。 void readRemoteObjectList(ListIRemoteObject objects) 从 MessageParcel 中读取 IRemoteObject 对象的列表。 void reclaim() 将 MessageParcel 对象添加到缓存池。 void updateDataVersion(IRemoteObject object) 将远程对象数据版本更新为 MessageParcel 对象。 boolean writeAshmem(Ashmem ashmem) 将指定的 Ashmem 对象写入此 MessageParcel。 void writeException(Exception exception) 将异常写入 MessageParcel。 boolean writeFileDescriptor(FileDescriptor descriptor) 序列化文件描述符并将其写入 MessageParcel。 boolean writeInterfaceToken(String token) 将接口令牌写入 MessageParcel 对象。 void writeNoException() 不向 MessageParcel 写入异常。 boolean writeRawData(byte[] rawData, int size) 将要发送到远程进程的原始数据写入 MessageParcel 对象。 boolean writeRemoteObject(IRemoteObject object) 序列化远程对象并将其写入 MessageParcel 对象。 boolean writeRemoteObjectArray(IRemoteObject[] objects) 将 IRemoteObject 对象数组写入 MessageParcel。 boolean writeRemoteObjectList(ListIRemoteObject objects)...

鸿蒙OS MessageOption

MessageOption java.lang.Object |—ohos.rpc.MessageOption public class MessageOption extends Object 定义与 sendRequest 一起发送消息的选项。 字段摘要 修饰符和类型 字段 描述 static int TF_ACCEPT_FDS 表示可以为 sendRequest 接口返回文件描述符。 static int TF_ASYNC 表示以异步方式调用 sendRequest 接口。 static int TF_SYNC 表示以同步方式调用 sendRequest 接口。 static int TF_WAIT_TIME 表示等待同步调用的秒数。 构造函数摘要 构造函数 描述 MessageOption() 构造一个默认的 MessageOption 对象。 MessageOption(int flags) 使用 flags 中指定的标志构造指定的 MessageOption 对象。 MessageOption(int flags, int waitTime) 使用 flags 中指定的标志构造指定的 MessageOption 对象。 方法总结 修饰符和类型 方法 描述 int getFlags() 获取 MessageOption 对象的同步或异步消息标志。 int getWaitTime() 获取等待时间。 void setFlags(int flag) 为 MessageOption 对象设置同步或异步消息传递标志。 void setWaitTime(int waitTime) 设置在确定请求超时之前等待的时间。 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 字段详细信息 TF_ACCEPT_FDS public static final int TF_ACCEPT_FDS 表示可以为 sendRequest 接口返回文件描述符。 TF_ASYNC public static final int TF_ASYNC 表示以异步方式调用 sendRequest 接口。 TF_SYNC public static final int TF_SYNC 表示以同步方式调用 sendRequest 接口。 TF_WAIT_TIME public static final int TF_WAIT_TIME 表示等待同步调用的秒数。 构造函数详细信息 MessageOption public MessageOption() 构造一个默认的 MessageOption 对象。 默认 MessageOption 对象使用同步消息传递。 MessageOption public MessageOption(int flags) 使用 flags 中指定的标志构造指定的 MessageOption 对象。 参数: 参数名称 参数描述 flags 指示用于创建对象的标志,TF_SYNC 用于同步调用,TF_ASYNC 用于异步调用。 MessageOption public MessageOption(int flags, int...

鸿蒙OS IPCSkeleton

IPCSkeleton java.lang.Object |—ohos.rpc.IPCSkeleton public class IPCSkeleton extends Object 在IPC骨架中提供静态接口,用于获取服务、读写对象、获取UID和PID、获取本地和对端设备的ID、检查是否在同一设备上进行了接口调用。 构造函数摘要 构造函数 描述 IPCSkeleton() 方法总结 修饰符和类型 方法 描述 static int flushCommands(IRemoteObject object) 将所有挂起的命令从指定的 RemoteProxy 刷新到相应的 RemoteObject。 static String getCallingDeviceID() 获取对端进程所在设备的ID。 static int getCallingPid() 获取代理的PID。 static int getCallingUid() 获取代理的 UID。 static IRemoteObject getContextObject() 获取已注册服务的本地 IRemoteObject 引用。 static String getLocalDeviceID() 获取本地设备的ID。 static boolean isLocalCalling() 检查是否在同一设备上进行了呼叫。 static String resetCallingIdentity() 将远程用户的 UID 和 PID 替换为本地用户的 UID 和 PID。 static boolean setCallingIdentity(String identity) 将 UID 和 PID 恢复为远程用户的 UID 和 PID。 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 构造函数详细信息 IPCSkeleton public IPCSkeleton() 方法详情 getContextObject public static IRemoteObject getContextObject() 获取已注册服务的本地 IRemoteObject 引用。 此方法是静态的。 返回: 返回已注册服务的 IRemoteObject 引用。 getCallingPid public static int getCallingPid() 获取代理的PID。 此方法是静态的。 RemoteProxy对象与RemoteObject对象通信时PID为正整数,通信结束后恢复为0。 如果从 RemoteProxy 对象调用该方法,则返回 0; 如果从 RemoteObject 对象调用该方法,则返回对应的 RemoteProxy 对象的 PID。 返回: 返回代理的 PID。 getCallingUid public static int getCallingUid() 获取代理的 UID。 此方法是静态的。 RemoteProxy对象与RemoteObject对象通信时UID为正整数,通信结束后恢复为0。 如果从 RemoteProxy 对象调用该方法,则返回 0; 如果从 RemoteObject 对象调用该方法,则返回对应的 RemoteProxy 对象的 UID。 返回: 返回代理的 UID。 getCallingDeviceID public static String getCallingDeviceID() 获取对端进程所在设备的ID。 此方法是静态的。 返回: 返回对等进程所在设备的ID。 getLocalDeviceID public...

鸿蒙OS IRemoteObject.DeathRecipient

IRemoteObject.DeathRecipient public static interface IRemoteObject.DeathRecipient 表示订阅 RemoteObject 的死亡通知的 IRemoteObject 的内部类。 当收到死亡通知时,会调用 DeathRecipient#onRemoteDied 方法进行后续操作。 RemoteObject RemoteObject 所在的进程死亡。 RemoteObject所在的设备被关闭或重启。 当 RemoteObject 和 RemoteProxy 驻留在不同的设备上时,RemoteObject 将从网络中删除。 方法总结 修饰符和类型 方法 描述 void onRemoteDied() 当收到 RemoteObject 的死亡通知时调用以执行后续操作。 方法详情 onRemoteDied void onRemoteDied() 当收到 RemoteObject 的死亡通知时调用以执行后续操作。 该方法通常用于清除RemoteProxy的资源或通知其他对象RemoteObject死亡。 您可以重写此方法以确定后续操作。

鸿蒙OS IRemoteObject

IRemoteObject public interface IRemoteObject 必须由服务提供者和用户实现的远程对象接口。 该接口可用于查询或获取接口描述符、添加或删除死亡通知、将对象状态转储到特定文件以及发送消息。 嵌套类摘要 修饰符和类型 接口 描述 static interface IRemoteObject.DeathRecipient 表示订阅 RemoteObject 的死亡通知的 IRemoteObject 的内部类。 字段摘要 修饰符和类型 字段 描述 static int DUMP_TRANSACTION 指示转储操作的消息代码。 static int INTERFACE_TRANSACTION 指示传输的消息代码。 static int MAX_TRANSACTION_ID 表示有效消息代码的最大值。 static int MIN_TRANSACTION_ID 指示有效消息代码的最小值。 static int PING_TRANSACTION 指示 Ping 操作的消息代码。 方法总结 修饰符和类型 方法 描述 boolean addDeathRecipient(IRemoteObject.DeathRecipient recipient, int flags) 注册用于接收远程对象死亡通知的回调。 void dump(FileDescriptor fd, String[] args) 将对象状态转储到特定文件。 String getInterfaceDescriptor() 获取对象的接口描述符。 boolean isObjectDead() 检查对象是否死亡。 IRemoteBroker queryLocalInterface(String descriptor) 查询接口描述。 boolean removeDeathRecipient(IRemoteObject.DeathRecipient recipient, int flags) 取消注册用于接收远程对象死亡通知的回调。 boolean sendRequest(int code, MessageParcel data, MessageParcel reply, MessageOption option) 以同步或异步模式向对等进程发送 MessageParcel 消息。 void slowPathDump(FileDescriptor fd, String[] args) 将数据异步转储到指定文件。 字段详细信息 DUMP_TRANSACTION static final int DUMP_TRANSACTION 指示转储操作的消息代码。 INTERFACE_TRANSACTION static final int INTERFACE_TRANSACTION 指示传输的消息代码。 MAX_TRANSACTION_ID static final int MAX_TRANSACTION_ID 表示有效消息代码的最大值。 此常量用于检查操作的有效性。 MIN_TRANSACTION_ID static final int MIN_TRANSACTION_ID 指示有效消息代码的最小值。 此常量用于检查操作的有效性。 PING_TRANSACTION static final int PING_TRANSACTION 指示 Ping 操作的消息代码。 方法详情 queryLocalInterface IRemoteBroker queryLocalInterface(String descriptor) 查询接口描述。 为服务提供者使用的接口返回一个有效的 IRemoteBroker 对象; 服务用户使用的接口返回null,表示该接口不是本地接口。 参数: 参数名称 参数描述 descriptor 表示接口描述符的字符串。 返回: 返回绑定到指定接口描述符的 IRemoteBroker 对象。 sendRequest boolean sendRequest(int code, MessageParcel data,...

鸿蒙OS IRemoteBroker

IRemoteBroker public interface IRemoteBroker 获取远程代理对象的持有者。 方法总结 修饰符和类型 方法 描述 IRemoteObject asObject() 获取远程代理对象的持有者。 方法详情 asObject IRemoteObject asObject() 获取远程代理对象的持有者。 返回: 如果调用者是 RemoteObject,则返回 RemoteObject; 如果调用者是 RemoteProxy,则返回 IRemoteObject。

鸿蒙OS FormInfo.FormType

FormInfo.FormType java.lang.Object |—java.lang.Enum<FormInfo.FormType& |—|—ohos.bundle.FormInfo.FormType public static enum FormInfo.FormType extends Enum<FormInfo.FormType> 枚举表单的类型。 目前支持 Java 和 JS 表单。 枚举常量摘要 枚举常量 描述 JAVA Java表单 JS JS表单 方法总结 修饰符和类型 方法 描述 static FormInfo.FormType valueOf(String name) 返回具有指定名称的此类型的枚举常量。 static FormInfo.FormType[] values() 按照声明的顺序返回包含此枚举类型常量的数组。 从类 java.lang.Enum 继承的方法 clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf 从类 java.lang.Object 继承的方法 getClass, notify, notifyAll, wait, wait, wait 枚举常量详细信息 JAVA public static final FormInfo.FormType JAVA Java表单 JS public static final FormInfo.FormType JS JS表单 方法详情 values public static FormInfo.FormType[] values() 按照声明的顺序返回包含此枚举类型常量的数组。 此方法可用于迭代常量,如下所示: for (FormInfo.FormType c : FormInfo.FormType.values()) System.out.println(c); 返回: 包含此枚举类型的常量的数组,按声明的顺序排列 valueOf public static FormInfo.FormType valueOf(String name) 返回具有指定名称的此类型的枚举常量。 该字符串必须与用于在此类型中声明枚举常量的标识符完全匹配。 (不允许使用无关的空白字符。) 参数: 参数名称 参数描述 name 要返回的枚举常量的名称。 返回: 具有指定名称的枚举常量 Throws: Throw名称 Throw描述 IllegalArgumentException 如果此枚举类型没有具有指定名称的常量 NullPointerException 如果参数为空

鸿蒙OS AbilityInfo.LaunchMode

AbilityInfo.LaunchMode java.lang.Object |—java.lang.Enum<AbilityInfo.LaunchMode& |—|—ohos.bundle.AbilityInfo.LaunchMode public static enum AbilityInfo.LaunchMode extends Enum<AbilityInfo.LaunchMode> 枚举ability启动模式。 您可以保留默认值 SINGLETON。 枚举常量摘要 枚举常量 描述 SINGLEMISSION 表示该ability在每个任务中只有一个实例。 SINGLETON 表示该ability只有一个实例。 STANDARD 表示该ability可以有多个实例。 方法总结 修饰符和类型 方法 描述 static AbilityInfo.LaunchMode valueOf(String name) 返回具有指定名称的此类型的枚举常量。 static AbilityInfo.LaunchMode[] values() 按照声明的顺序返回包含此枚举类型常量的数组。 从类 java.lang.Enum 继承的方法 clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf 从类 java.lang.Object 继承的方法 getClass, notify, notifyAll, wait, wait, wait 枚举常量详细信息 SINGLETON public static final AbilityInfo.LaunchMode SINGLETON 表示该ability只有一个实例。 STANDARD public static final AbilityInfo.LaunchMode STANDARD 表示该ability可以有多个实例。 SINGLEMISSION public static final AbilityInfo.LaunchMode SINGLEMISSION 表示该ability在每个任务中只有一个实例。 方法详情 values public static AbilityInfo.LaunchMode[] values() 按照声明的顺序返回包含此枚举类型常量的数组。 此方法可用于迭代常量,如下所示: for (AbilityInfo.LaunchMode c : AbilityInfo.LaunchMode.values()) System.out.println(c); 返回: 包含此枚举类型的常量的数组,按声明的顺序排列 valueOf public static AbilityInfo.LaunchMode valueOf(String name) 返回具有指定名称的此类型的枚举常量。 该字符串必须与用于在此类型中声明枚举常量的标识符完全匹配。 (不允许使用无关的空白字符。) 参数: 参数名称 参数描述 name 要返回的枚举常量的名称。 返回: 具有指定名称的枚举常量 Throws: Throw名称 Throw描述 IllegalArgumentException 如果此枚举类型没有具有指定名称的常量 NullPointerException 如果参数为空

鸿蒙OS AbilityInfo.DisplayOrientation

AbilityInfo.DisplayOrientation java.lang.Object |—java.lang.Enum<AbilityInfo.DisplayOrientation& |—|—ohos.bundle.AbilityInfo.DisplayOrientation public static enum AbilityInfo.DisplayOrientation extends Enum<AbilityInfo.DisplayOrientation> 枚举ability显示方向。 DisplayOrientation 仅对 AbilityType#PAGE 类型的ability有效。 您可以保留默认值 UNSPECIFIED。 枚举摘要常量 枚举常量 描述 FOLLOWRECENT 指示页面ability方向与堆栈中最近的ability方向相同。 LANDSCAPE 表示横向 PORTRAIT 表示纵向 UNSPECIFIED 表示系统自动确定显示方向。 方法总结 修饰符和类型 方法 描述 static AbilityInfo.DisplayOrientation valueOf(String name) 返回具有指定名称的此类型的枚举常量。 static AbilityInfo.DisplayOrientation[] values() 按照声明的顺序返回包含此枚举类型常量的数组。 从类 java.lang.Enum 继承的方法 clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf 从类 java.lang.Object 继承的方法 getClass, notify, notifyAll, wait, wait, wait 枚举常量详细信息 UNSPECIFIED public static final AbilityInfo.DisplayOrientation UNSPECIFIED 表示系统自动确定显示方向。 LANDSCAPE public static final AbilityInfo.DisplayOrientation LANDSCAPE 表示横向。 PORTRAIT public static final AbilityInfo.DisplayOrientation PORTRAIT 表示纵向。 FOLLOWRECENT public static final AbilityInfo.DisplayOrientation FOLLOWRECENT 指示页面ability方向与堆栈中最近的ability方向相同。 方法详情 values public static AbilityInfo.DisplayOrientation[] values() 按照声明的顺序返回包含此枚举类型常量的数组。 此方法可用于迭代常量,如下所示: for (AbilityInfo.DisplayOrientation c : AbilityInfo.DisplayOrientation.values()) System.out.println(c); 返回: 包含此枚举类型的常量的数组,按声明的顺序排列 valueOf public static AbilityInfo.DisplayOrientation valueOf(String name) 返回具有指定名称的此类型的枚举常量。 该字符串必须与用于在此类型中声明枚举常量的标识符完全匹配。 (不允许使用无关的空白字符。) 参数: 参数名称 参数描述 name 要返回的枚举常量的名称。 返回: 具有指定名称的枚举常量 Throws: Throw名称 Throw描述 IllegalArgumentException 如果此枚举类型没有具有指定名称的常量 NullPointerException 如果参数为空

鸿蒙OS AbilityInfo.AbilityType

AbilityInfo.AbilityType java.lang.Object |—java.lang.Enum<AbilityInfo.AbilityType& |—|—ohos.bundle.AbilityInfo.AbilityType public static enum AbilityInfo.AbilityType extends Enum<AbilityInfo.AbilityType> 枚举ability可以使用的模板类型。 必须指定ability类型。 通常,该值为 PAGE、SERVICE 或 DATA。 枚举常量摘要 枚举常量 描述 DATA 表示该ability用于提供数据访问服务。 PAGE 表示该ability有一个 UI。 SERVICE 表示该ability没有 UI。 UNKNOWN 表示未知的ability类型。 WEB 表示该ability是 Ohos 浏览服务 (HBS)。 方法总结 修饰符和类型 方法 描述 static AbilityInfo.AbilityType valueOf(String name) 返回具有指定名称的此类型的枚举常量。 static AbilityInfo.AbilityType[] values() 按照声明的顺序返回包含此枚举类型常量的数组。 从类 java.lang.Enum 继承的方法 clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf 从类 java.lang.Object 继承的方法 getClass, notify, notifyAll, wait, wait, wait 枚举常量详细信息 UNKNOWN public static final AbilityInfo.AbilityType UNKNOWN 表示未知的ability类型。 PAGE public static final AbilityInfo.AbilityType PAGE 表示该ability有一个 UI。 SERVICE public static final AbilityInfo.AbilityType SERVICE 表示该ability没有 UI。 DATA public static final AbilityInfo.AbilityType DATA 表示该ability用于提供数据访问服务。 WEB public static final AbilityInfo.AbilityType WEB 表示该ability是 Ohos 浏览服务 (HBS)。 方法详情 values public static AbilityInfo.AbilityType[] values() 按照声明的顺序返回包含此枚举类型常量的数组。 此方法可用于迭代常量,如下所示: for (AbilityInfo.AbilityType c : AbilityInfo.AbilityType.values()) System.out.println(c); 返回: 包含此枚举类型的常量的数组,按声明的顺序排列 valueOf public static AbilityInfo.AbilityType valueOf(String name) 返回具有指定名称的此类型的枚举常量。 该字符串必须与用于在此类型中声明枚举常量的标识符完全匹配。 (不允许使用无关的空白字符。) 参数: 参数名称 参数描述 name 要返回的枚举常量的名称。 返回: 具有指定名称的枚举常量...