blob: 2f48325beebe633e9c37e89c8b2f5d38c510ac03 [file] [log] [blame]
Alexander Afanasyev2d600f72013-11-21 18:20:37 -08001.. _Data:
2
3Data Class
4==========
5
6:[C++]:
7 Namespace: ``ndn``
8
9:[Python]:
10 Module: ``pyndn``
11
12Data Constructor
13----------------
14
15Create a new Data with the optional values.
16
17:[C++]:
18
19.. code-block:: c++
20
21 Data(
22
23 [const Name& name]
24
25 );
26
27:[JavaScript]:
28
29.. code-block:: javascript
30
31 var Data = function Data(
32
33 [name // Name]
34
35 )
36
37:[Python]:
38
39.. code-block:: python
40
41 def __init__(self
42
43 [, name // Name]
44
45 )
46
47:Parameters:
48
49 - ``name``
50 (optional) The name for the data packet.
51
52Data.getContent Method
53----------------------
54
55Get content of the Data packet.
56
57:[C++]:
58
59.. code-block:: c++
60
61 const Blob& getContent() const;
62
63:[JavaScript]:
64
65.. code-block:: javascript
66
67 // Returns Blob
68 Data.prototype.getContent = function()
69
70:Returns:
71
72 A pointer to the content byte array.
73
74Data.setContent Method
75----------------------
76
77Set content to point to an existing byte array.
78
79:[C++]:
80
81.. code-block:: c++
82
83 void setContent(
84
85 const Blob& content
86
87 );
88
89:Parameters:
90
91 - ``content``
92 The pointer to the byte array.
93
94Data.wireDecode Method
95----------------------
96
Alexander Afanasyev24707862013-11-26 19:31:45 -080097Decode the input from wire format and update this Data.
Alexander Afanasyev2d600f72013-11-21 18:20:37 -080098
99:[C++]:
100
101.. code-block:: c++
102
103 void wireDecode(
104
105 const std::vector<uint8_t>& input
Alexander Afanasyev2d600f72013-11-21 18:20:37 -0800106
107 );
108
109:[JavaScript]:
110
111.. code-block:: javascript
112
113 ContentObject.prototype.decode = function(
114
115 input // Uint8Array
Alexander Afanasyev2d600f72013-11-21 18:20:37 -0800116
117 )
118
119:Parameters:
120
121 - ``input``
122 The input byte array to be decoded.
123
Alexander Afanasyev2d600f72013-11-21 18:20:37 -0800124Data.wireEncode Method
125----------------------
126
Alexander Afanasyev24707862013-11-26 19:31:45 -0800127Encode this Data to wire format.
Alexander Afanasyev2d600f72013-11-21 18:20:37 -0800128
129:[C++]:
130
131.. code-block:: c++
132
Alexander Afanasyev24707862013-11-26 19:31:45 -0800133 SignedBlob wireEncode() const;
Alexander Afanasyev2d600f72013-11-21 18:20:37 -0800134
135:[JavaScript]:
136
137.. code-block:: javascript
138
139 // Returns Uint8Array
Alexander Afanasyev24707862013-11-26 19:31:45 -0800140 ContentObject.prototype.encode = function()
Alexander Afanasyev2d600f72013-11-21 18:20:37 -0800141
142:Returns:
143
144 The encoded byte array as a SignedBlob.