Class Parcel
Definition
- Namespace:
- Tizen.Applications.RPCPort
- Assembly:
- Tizen.Applications.Common.dll
The class that helps to perform marshalling and unmarshalling for RPC.
C#Copypublic class Parcel : IDisposable
- Inheritance
-
objectParcel
- Implements
-
System.IDisposable
Constructors
Declaration
C#Copypublic Parcel()
Exceptions
| Type | Condition |
|---|---|
| InvalidIOException | Thrown when an internal IO error occurs. |
Declaration
C#Copypublic Parcel(bool withHeader)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | withHeader | Determines whether the created parcel object includes a header or not. |
Exceptions
| Type | Condition |
|---|---|
| InvalidIOException | Thrown when an internal I/O error occurs during the construction process. |
Declaration
C#Copypublic Parcel(byte[] bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | bytes | An array of bytes that represents the content of the parcel. |
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | Thrown if an invalid argument is passed in or an internal I/O error occurs. |
Declaration
C#Copypublic Parcel(Port port)
Parameters
| Type | Name | Description |
|---|---|---|
| Port | port | The port object to create a parcel from. |
Exceptions
| Type | Condition |
|---|---|
| InvalidIOException | An internal IO error occurred while creating the parcel. |
Methods
Declaration
C#Copypublic void Dispose()
Declaration
C#Copyprotected ~Parcel()
Declaration
C#Copypublic ParcelHeader GetHeader()
Returns
| Type | Description |
|---|---|
| ParcelHeader | Parcel header |
Declaration
C#Copypublic byte[] Read(int size)
Parameters
| Type | Name | Description |
|---|---|---|
| int | size | The number of bytes to read. |
Returns
| Type | Description |
|---|---|
| byte[] | An array of bytes that were read from the parcel. |
Declaration
C#Copypublic int ReadArrayCount()
Returns
| Type | Description |
|---|---|
| int | The number of elements in the array. |
Declaration
C#Copypublic bool ReadBool()
Returns
| Type | Description |
|---|---|
| bool | The boolean data. |
Declaration
C#Copypublic Bundle ReadBundle()
Returns
| Type | Description |
|---|---|
| Bundle | The Bundle data. |
Declaration
C#Copypublic byte ReadByte()
Returns
| Type | Description |
|---|---|
| byte | The byte value. |
Declaration
C#Copypublic double ReadDouble()
Returns
| Type | Description |
|---|---|
| double | The double data. |
Declaration
C#Copypublic float ReadFloat()
Returns
| Type | Description |
|---|---|
| float | The float data. |
Declaration
C#Copypublic int ReadInt()
Returns
| Type | Description |
|---|---|
| int | The integer data. |
Declaration
C#Copypublic long ReadLong()
Returns
| Type | Description |
|---|---|
| long | The long data. |
Declaration
C#Copypublic short ReadShort()
Returns
| Type | Description |
|---|---|
| short | The short data. |
Declaration
C#Copypublic string ReadString()
Returns
| Type | Description |
|---|---|
| string | The string data. |
Declaration
C#Copypublic void Send(Port p)
Parameters
| Type | Name | Description |
|---|---|---|
| Port | p |
Exceptions
| Type | Condition |
|---|---|
| InvalidIOException | Thrown when an internal IO error occurs. |
Declaration
C#Copypublic byte[] ToBytes()
Returns
| Type | Description |
|---|---|
| byte[] | An array of bytes containing the contents of the parcel. |
Exceptions
| Type | Condition |
|---|---|
| InvalidIOException | Thrown if an internal I/O error occurs during conversion. |
Declaration
C#Copypublic void Write(byte[] bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | bytes | An array of bytes containing the data to be written. |
Declaration
C#Copypublic void WriteArrayCount(int cnt)
Parameters
| Type | Name | Description |
|---|---|---|
| int | cnt | The number of elements in the array. |
Declaration
C#Copypublic void WriteBool(bool b)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | b | The boolean value to write. |
Declaration
C#Copypublic void WriteBundle(Bundle b)
Parameters
| Type | Name | Description |
|---|---|---|
| Bundle | b | The Bundle object to write. |
Declaration
C#Copypublic void WriteByte(byte b)
Parameters
| Type | Name | Description |
|---|---|---|
| byte | b | The byte value to be written into the parcel object. |
Declaration
C#Copypublic void WriteDouble(double b)
Parameters
| Type | Name | Description |
|---|---|---|
| double | b | The double data to write. |
Declaration
C#Copypublic void WriteFloat(float b)
Parameters
| Type | Name | Description |
|---|---|---|
| float | b | The float data to write into the parcel object. |
Declaration
C#Copypublic void WriteInt(int b)
Parameters
| Type | Name | Description |
|---|---|---|
| int | b | The integer value to write. |
Examples
Here's an example showing how to write an integer value into a parcel object:
Copy// Create a new parcel object Parcel parcel = new Parcel(); // Write an integer value into the parcel object parcel.WriteInt(42); // Do something else with the parcel object... ...
Declaration
C#Copypublic void WriteLong(long b)
Parameters
| Type | Name | Description |
|---|---|---|
| long | b | The long data to write. |
Declaration
C#Copypublic void WriteShort(short b)
Parameters
| Type | Name | Description |
|---|---|---|
| short | b | The short data to write. |
Declaration
C#Copypublic void WriteString(string b)
Parameters
| Type | Name | Description |
|---|---|---|
| string | b | The string data to be written into the parcel object. |