MetaInfo Class¶
The MetaInfo class is used by Data and represents the fields of an NDN MetaInfo. The MetaInfo type specifies the type of the content in the Data packet (usually BLOB).
[C++]: | #include <ndn-cpp/meta-info.hpp> Namespace:
ndn |
---|---|
[Python]: | Module: pyndn |
[Java]: | Package: net.named_data.jndn |
MetaInfo Constructors¶
MetaInfo Constructor (default)¶
Create a new MetaInfo where type is the default value BLOB.
[C++]: | MetaInfo();
|
---|---|
[Python]: | def __init__(self)
|
[JavaScript]: | var MetaInfo = function MetaInfo()
|
[Java]: | public MetaInfo()
|
MetaInfo Constructor (copy)¶
Create a new MetaInfo as a deep copy of the given metaInfo.
[C++]: | MetaInfo(
const MetaInfo& metaInfo
);
|
---|---|
[Python]: | def __init__(self,
metaInfo # MetaInfo
)
|
[JavaScript]: | var MetaInfo = function MetaInfo(
metaInfo // MetaInfo
)
|
[Java]: | public MetaInfo(
MetaInfo metaInfo
)
|
Parameters: |
|
MetaInfo Get Methods¶
MetaInfo.getFinalBlockId Method¶
Get the final block ID.
[C++]: | const Name::Component& getFinalBlockId() const;
|
---|---|
[Python]: | # Returns Name.Component
def getFinalBlockId(self)
|
[JavaScript]: | // Returns Name.Component
MetaInfo.prototype.getFinalBlockId = function()
|
[Java]: | public final Name.Component getFinalBlockId()
|
Returns: | The final block ID as a Name.Component. If the Name.Component getValue().size() is 0, then the final block ID is not specified. |
MetaInfo.getFreshnessPeriod Method¶
Get the data packet freshness period.
[C++]: | Milliseconds getFreshnessPeriod() const;
|
---|---|
[Python]: | # Returns float
def getFreshnessPeriod(self)
|
[JavaScript]: | // Returns number
MetaInfo.prototype.getFreshnessPeriod = function()
|
[Java]: | public final double getFreshnessPeriod()
|
Returns: | The freshness period in milliseconds. If not specified, return |
MetaInfo.getOtherTypeCode Method¶
Get the content type code from the packet which is other than a recognized ContentType enum value. This is only meaningful if getType() is OTHER_CODE.
[C++]: | int getOtherTypeCode() const;
|
---|---|
[Python]: | # Returns int
def getOtherTypeCode(self)
|
[JavaScript]: | // Returns number
MetaInfo.prototype.getOtherTypeCode = function()
|
[Java]: | public final int getOtherTypeCode()
|
Returns: | The type code. |
MetaInfo.getType Method¶
Get the content type.
[C++]: | ndn_ContentType getType() const;
|
---|---|
[Python]: | # Returns int
def getType(self)
|
[JavaScript]: | // Returns number
MetaInfo.prototype.getType = function()
|
[Java]: | public final ContentType getType()
|
Returns: | The content type enum value which is BLOB, LINK, KEY, NACK, or OTHER_CODE as follows. If this is OTHER_CODE, then call getOtherTypeCode() to get the unrecognized content type code.
|
MetaInfo Set Methods¶
MetaInfo.setFinalBlockId Method¶
Set the final block ID.
[C++]: | void setFinalBlockId(
const Name::Component& finalBlockId
);
|
---|---|
[Python]: | def setFinalBlockId(self,
finalBlockId # Name.Component
)
|
[JavaScript]: | MetaInfo.prototype.setFinalBlockId = function(
finalBlockId // Name.Component
)
|
[Java]: | public final void setFinalBlockId(
Name.Component finalBlockId
)
|
Parameters: |
|
MetaInfo.setFreshnessPeriod Method¶
Set the freshness period.
[C++]: | void setFreshnessPeriod(
Milliseconds freshnessPeriod
);
|
---|---|
[Python]: | def setFreshnessPeriod(self,
freshnessPeriod # float
)
|
[JavaScript]: | MetaInfo.prototype.setFreshnessPeriod = function(
freshnessPeriod // number
)
|
[Java]: | public final void setFreshnessPeriod(
double freshnessPeriod
)
|
Parameters: |
|
MetaInfo.setOtherTypeCode Method¶
Set the packet’s content type code to use when the content type enum is OTHER_CODE. If the packet’s content type code is a recognized enum value, just call setType().
[C++]: | void setOtherTypeCode(
int otherTypeCode
);
|
---|---|
[Python]: | def setOtherTypeCode(self,
otherTypeCode # int
)
|
[JavaScript]: | MetaInfo.prototype.setOtherTypeCode = function(
otherTypeCode // number
)
|
[Java]: | public final void setOtherTypeCode(
int otherTypeCode
)
|
Parameters: |
|
MetaInfo.setType Method¶
Set the content type.
[C++]: | void setType(
ndn_ContentType type
);
|
---|---|
[Python]: | def setType(self,
type # int
)
|
[JavaScript]: | MetaInfo.prototype.setType = function(
type // number
)
|
[Java]: | public final void setType(
ContentType type
)
|
Parameters: |
|