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
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. |
Parcel(Parcel, uint, uint)
Constructs a sub parcel from origin parcel.
Declaration
public Parcel(Parcel origin, uint startPos, uint size)
Parameters
| Type | Name | Description |
|---|---|---|
| Parcel | origin | The origin parcel. |
| uint | startPos | The start position from origin parcel. |
| uint | size | The size of the new parcel. |
Exceptions
| Type | Condition |
|---|---|
| InvalidIOException | Thrown when an internal IO 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()
GetDataSize()
Gets the size of the raw data of the parcel.
Declaration
public uint GetDataSize()
Returns
| Type | Description |
|---|---|
| uint | The size of data |
Exceptions
| Type | Condition |
|---|---|
| InvalidIOException | Thrown when an internal IO error occurs. |
GetHeader()
Gets header of rpc port parcel.
Declaration
public ParcelHeader GetHeader()
Returns
| Type | Description |
|---|---|
| ParcelHeader | Parcel header |
GetReader()
Gets the reader pointer of the parcel to the start.
Declaration
public uint GetReader()
Returns
| Type | Description |
|---|---|
| uint | The position of the reader |
Exceptions
| Type | Condition |
|---|---|
| InvalidIOException | Thrown when an internal IO error occurs. |
Pin()
Pin the memory. Once it is called, the capacity would not be changed.
Declaration
public void Pin()
Exceptions
| Type | Condition |
|---|---|
| InvalidIOException | Thrown when an internal IO error occurs. |
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. |
ReadSByte()
Reads a signed byte value from the parcel object.
Declaration
public sbyte ReadSByte()
Returns
| Type | Description |
|---|---|
| sbyte | The byte value. |
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. |
ReadUInt()
Reads an unsigned integer value from the parcel object.
Declaration
public uint ReadUInt()
Returns
| Type | Description |
|---|---|
| uint | The integer data. |
ReadULong()
Reads an unsigned long value from the parcel object.
Declaration
public ulong ReadULong()
Returns
| Type | Description |
|---|---|
| ulong | The unsigned long data. |
ReadUShort()
Reads an unsigned short value from the parcel object.
Declaration
public ushort ReadUShort()
Returns
| Type | Description |
|---|---|
| ushort | The unsigned short data. |
Reserve(uint)
Reserves bytes to write later.
The bytes to reserve.Declaration
public void Reserve(uint size)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | size |
Exceptions
| Type | Condition |
|---|---|
| InvalidIOException | Thrown when an internal IO error occurs. |
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. |
SetDataSize(uint)
Sets the size of the raw data of the parcel.
Declaration
public void SetDataSize(uint size)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | size | The size of data. |
Exceptions
| Type | Condition |
|---|---|
| InvalidIOException | Thrown when an internal IO error occurs. |
SetReader(uint)
Sets the reader pointer of the parcel to the start.
Declaration
public void SetReader(uint pos)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | pos | The position to read. |
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. |
WriteSByte(sbyte)
Writes a single signed byte value into the parcel object.
Declaration
public void WriteSByte(sbyte b)
Parameters
| Type | Name | Description |
|---|---|---|
| sbyte | b | The signed byte value to be written into the parcel object. |
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. |
WriteUInt(uint)
Writes an unsigned integer value into the parcel object.
Declaration
public void WriteUInt(uint b)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | b | The unsigned integer value to write. |
WriteULong(ulong)
Writes an unsigned long value into the parcel object.
Declaration
public void WriteULong(ulong b)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | b | The unsigned long data to write. |
WriteUShort(ushort)
Writes a unsigned short value into parcel object.
Declaration
public void WriteUShort(ushort b)
Parameters
| Type | Name | Description |
|---|---|---|
| ushort | b | The unsigned short data to write. |