Class Parcel
Definition
- Namespace:
- Tizen.Applications.RPCPort
- Assembly:
- Tizen.Applications.Common.dll
The class that helps to perform marshalling and unmarshalling for RPC.
public class Parcel : IDisposable
- Inheritance
-
objectParcel
- Implements
-
System.IDisposable
Constructors
View SourceParcel()
Constructor for this class.
Declaration
public Parcel()
Exceptions
Type | Condition |
---|---|
InvalidIOException | Thrown when an internal IO error occurs. |
Parcel(bool)
Constructs a new instance of the Parcel class.
Declaration
public 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. |
Parcel(byte[])
Constructs a new Parcel object from the specified raw bytes.
Declaration
public 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. |
Parcel(Port)
Creates a new parcel object from a specified port object.
Declaration
public 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
View SourceDispose()
Release all the resources used by the class Parcel.
Declaration
public void Dispose()
~Parcel()
Finalizer of the class Parcel.
Declaration
protected ~Parcel()
GetHeader()
Gets header of rpc port parcel.
Declaration
public ParcelHeader GetHeader()
Returns
Type | Description |
---|---|
ParcelHeader | Parcel header |
Read(int)
Reads bytes from the parcel object.
Declaration
public 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. |
ReadArrayCount()
Reads a count of an array from a parcel object.
Declaration
public int ReadArrayCount()
Returns
Type | Description |
---|---|
int | The number of elements in the array. |
ReadBool()
Reads a boolean value from the parcel object.
Declaration
public bool ReadBool()
Returns
Type | Description |
---|---|
bool | The boolean data. |
ReadBundle()
Reads a Bundle value from the parcel object.
Declaration
public Bundle ReadBundle()
Returns
Type | Description |
---|---|
Bundle | The Bundle data. |
ReadByte()
Reads a byte value from the parcel object.
Declaration
public byte ReadByte()
Returns
Type | Description |
---|---|
byte | The byte value. |
ReadDouble()
Reads a double value from the parcel object.
Declaration
public double ReadDouble()
Returns
Type | Description |
---|---|
double | The double data. |
ReadFloat()
Reads a float value from the parcel object.
Declaration
public float ReadFloat()
Returns
Type | Description |
---|---|
float | The float data. |
ReadInt()
Reads an integer value from the parcel object.
Declaration
public int ReadInt()
Returns
Type | Description |
---|---|
int | The integer data. |
ReadLong()
Reads a long value from the parcel object.
Declaration
public long ReadLong()
Returns
Type | Description |
---|---|
long | The long data. |
ReadShort()
Reads a short value from the parcel object.
Declaration
public short ReadShort()
Returns
Type | Description |
---|---|
short | The short data. |
ReadString()
Reads a string value from the parcel object.
Declaration
public string ReadString()
Returns
Type | Description |
---|---|
string | The string data. |
Send(Port)
Sends parcel data through the specified port.
Declaration
public void Send(Port p)
Parameters
Type | Name | Description |
---|---|---|
Port | p |
Exceptions
Type | Condition |
---|---|
InvalidIOException | Thrown when an internal IO error occurs. |
ToBytes()
Converts the current parcel into its raw bytes representation.
Declaration
public 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. |
Write(byte[])
Writes bytes into the parcel object.
Declaration
public void Write(byte[] bytes)
Parameters
Type | Name | Description |
---|---|---|
byte[] | bytes | An array of bytes containing the data to be written. |
WriteArrayCount(int)
Writes a count of an array into the parcel object.
Declaration
public void WriteArrayCount(int cnt)
Parameters
Type | Name | Description |
---|---|---|
int | cnt | The number of elements in the array. |
WriteBool(bool)
Writes a boolean value into the parcel object.
Declaration
public void WriteBool(bool b)
Parameters
Type | Name | Description |
---|---|---|
bool | b | The boolean value to write. |
WriteBundle(Bundle)
Writes a Bundle data into the parcel object.
Declaration
public void WriteBundle(Bundle b)
Parameters
Type | Name | Description |
---|---|---|
Bundle | b | The Bundle object to write. |
WriteByte(byte)
Writes a single byte value into the parcel object.
Declaration
public void WriteByte(byte b)
Parameters
Type | Name | Description |
---|---|---|
byte | b | The byte value to be written into the parcel object. |
WriteDouble(double)
Writes a double value into the parcel object.
Declaration
public void WriteDouble(double b)
Parameters
Type | Name | Description |
---|---|---|
double | b | The double data to write. |
WriteFloat(float)
Writes a float value into the parcel object.
Declaration
public void WriteFloat(float b)
Parameters
Type | Name | Description |
---|---|---|
float | b | The float data to write into the parcel object. |
WriteInt(int)
Writes an integer value into the parcel object.
Declaration
public 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:
// 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...
...
View Source
WriteLong(long)
Writes a long value into the parcel object.
Declaration
public void WriteLong(long b)
Parameters
Type | Name | Description |
---|---|---|
long | b | The long data to write. |
WriteShort(short)
Writes a short value into parcel object.
Declaration
public void WriteShort(short b)
Parameters
Type | Name | Description |
---|---|---|
short | b | The short data to write. |
WriteString(string)
Writes a string value into the parcel object.
Declaration
public void WriteString(string b)
Parameters
Type | Name | Description |
---|---|---|
string | b | The string data to be written into the parcel object. |