Class Parcel

Definition

Namespace:
Tizen.Applications.RPCPort
Assembly:
Tizen.Applications.Common.dll

The class that helps to perform marshalling and unmarshalling for RPC.

C#
Copy
public class Parcel : IDisposable
Inheritance
object
Parcel
Implements
System.IDisposable

Constructors

View Source

Parcel()

Constructor for this class.

Declaration
C#
Copy
public Parcel()
Exceptions
Type Condition
InvalidIOException

Thrown when an internal IO error occurs.

View Source

Parcel(bool)

Constructs a new instance of the Parcel class.

Declaration
C#
Copy
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.

View Source

Parcel(byte[])

Constructs a new Parcel object from the specified raw bytes.

Declaration
C#
Copy
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.

View Source

Parcel(Port)

Creates a new parcel object from a specified port object.

Declaration
C#
Copy
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 Source

Dispose()

Release all the resources used by the class Parcel.

Declaration
C#
Copy
public void Dispose()
View Source

~Parcel()

Finalizer of the class Parcel.

Declaration
C#
Copy
protected ~Parcel()
View Source

GetHeader()

Gets header of rpc port parcel.

Declaration
C#
Copy
public ParcelHeader GetHeader()
Returns
Type Description
ParcelHeader

Parcel header

View Source

Read(int)

Reads bytes from the parcel object.

Declaration
C#
Copy
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.

View Source

ReadArrayCount()

Reads a count of an array from a parcel object.

Declaration
C#
Copy
public int ReadArrayCount()
Returns
Type Description
int

The number of elements in the array.

View Source

ReadBool()

Reads a boolean value from the parcel object.

Declaration
C#
Copy
public bool ReadBool()
Returns
Type Description
bool

The boolean data.

View Source

ReadBundle()

Reads a Bundle value from the parcel object.

Declaration
C#
Copy
public Bundle ReadBundle()
Returns
Type Description
Bundle

The Bundle data.

View Source

ReadByte()

Reads a byte value from the parcel object.

Declaration
C#
Copy
public byte ReadByte()
Returns
Type Description
byte

The byte value.

View Source

ReadDouble()

Reads a double value from the parcel object.

Declaration
C#
Copy
public double ReadDouble()
Returns
Type Description
double

The double data.

View Source

ReadFloat()

Reads a float value from the parcel object.

Declaration
C#
Copy
public float ReadFloat()
Returns
Type Description
float

The float data.

View Source

ReadInt()

Reads an integer value from the parcel object.

Declaration
C#
Copy
public int ReadInt()
Returns
Type Description
int

The integer data.

View Source

ReadLong()

Reads a long value from the parcel object.

Declaration
C#
Copy
public long ReadLong()
Returns
Type Description
long

The long data.

View Source

ReadShort()

Reads a short value from the parcel object.

Declaration
C#
Copy
public short ReadShort()
Returns
Type Description
short

The short data.

View Source

ReadString()

Reads a string value from the parcel object.

Declaration
C#
Copy
public string ReadString()
Returns
Type Description
string

The string data.

View Source

Send(Port)

Sends parcel data through the specified port.

Declaration
C#
Copy
public void Send(Port p)
Parameters
Type Name Description
Port p
Exceptions
Type Condition
InvalidIOException

Thrown when an internal IO error occurs.

View Source

ToBytes()

Converts the current parcel into its raw bytes representation.

Declaration
C#
Copy
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.

View Source

Write(byte[])

Writes bytes into the parcel object.

Declaration
C#
Copy
public void Write(byte[] bytes)
Parameters
Type Name Description
byte[] bytes

An array of bytes containing the data to be written.

View Source

WriteArrayCount(int)

Writes a count of an array into the parcel object.

Declaration
C#
Copy
public void WriteArrayCount(int cnt)
Parameters
Type Name Description
int cnt

The number of elements in the array.

View Source

WriteBool(bool)

Writes a boolean value into the parcel object.

Declaration
C#
Copy
public void WriteBool(bool b)
Parameters
Type Name Description
bool b

The boolean value to write.

View Source

WriteBundle(Bundle)

Writes a Bundle data into the parcel object.

Declaration
C#
Copy
public void WriteBundle(Bundle b)
Parameters
Type Name Description
Bundle b

The Bundle object to write.

View Source

WriteByte(byte)

Writes a single byte value into the parcel object.

Declaration
C#
Copy
public void WriteByte(byte b)
Parameters
Type Name Description
byte b

The byte value to be written into the parcel object.

View Source

WriteDouble(double)

Writes a double value into the parcel object.

Declaration
C#
Copy
public void WriteDouble(double b)
Parameters
Type Name Description
double b

The double data to write.

View Source

WriteFloat(float)

Writes a float value into the parcel object.

Declaration
C#
Copy
public void WriteFloat(float b)
Parameters
Type Name Description
float b

The float data to write into the parcel object.

View Source

WriteInt(int)

Writes an integer value into the parcel object.

Declaration
C#
Copy
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:

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... ...
View Source

WriteLong(long)

Writes a long value into the parcel object.

Declaration
C#
Copy
public void WriteLong(long b)
Parameters
Type Name Description
long b

The long data to write.

View Source

WriteShort(short)

Writes a short value into parcel object.

Declaration
C#
Copy
public void WriteShort(short b)
Parameters
Type Name Description
short b

The short data to write.

View Source

WriteString(string)

Writes a string value into the parcel object.

Declaration
C#
Copy
public void WriteString(string b)
Parameters
Type Name Description
string b

The string data to be written into the parcel object.

Implements

System.IDisposable