Class: Data

Data

new Data(name, metaInfo, content)

Create a new Data with the optional values. There are 2 forms of constructor: new Data([name] [, content]); new Data(name, metaInfo [, content]);
Parameters:
Name Type Description
name Name
metaInfo MetaInfo
content Buffer
Source:

Methods

getChangeCount() → {number}

Get the change count, which is incremented each time this object (or a child object) is changed.
Source:
Returns:
The change count.
Type
number

getContent() → {Blob}

Get the data packet's content.
Source:
Returns:
The content as a Blob, which isNull() if unspecified.
Type
Blob

getContentAsBuffer()

Deprecated:
  • Use getContent. This method returns a Buffer which is the former behavior of getContent, and should only be used while updating your code.
Source:

getDefaultWireEncoding() → {SignedBlob}

Return the default wire encoding, which was encoded with getDefaultWireEncodingFormat().
Source:
Returns:
The default wire encoding, whose isNull() may be true if there is no default wire encoding.
Type
SignedBlob

getDefaultWireEncodingFormat() → {WireFormat}

Get the WireFormat which is used by getDefaultWireEncoding().
Source:
Returns:
The WireFormat, which is only meaningful if the getDefaultWireEncoding() is not isNull().
Type
WireFormat

getIncomingFaceId() → {number}

Get the incoming face ID according to the incoming packet header.
Source:
Returns:
The incoming face ID. If not specified, return null.
Type
number

getMetaInfo() → {MetaInfo}

Get the data packet's meta info.
Source:
Returns:
The meta info.
Type
MetaInfo

getName() → {Name}

Get the data packet's name.
Source:
Returns:
The name.
Type
Name

getSignature() → {Signature}

Get the data packet's signature object.
Source:
Returns:
The signature object.
Type
Signature

setContent(content) → {Data}

Set the content to the given value.
Parameters:
Name Type Description
content Blob | Buffer The content bytes. If content is not a Blob, then create a new Blob to copy the bytes (otherwise take another pointer to the same Blob).
Source:
Returns:
This Data so that you can chain calls to update values.
Type
Data

setLpPacket(lpPacket) → {Data}

An internal library method to set the LpPacket for an incoming packet. The application should not call this.
Parameters:
Name Type Description
lpPacket LpPacket The LpPacket. This does not make a copy.
Source:
Returns:
This Data so that you can chain calls to update values.
Type
Data

setMetaInfo(metaInfo) → {Data}

Set metaInfo to a copy of the given MetaInfo.
Parameters:
Name Type Description
metaInfo MetaInfo The MetaInfo which is copied.
Source:
Returns:
This Data so that you can chain calls to update values.
Type
Data

setName(name) → {Data}

Set name to a copy of the given Name.
Parameters:
Name Type Description
name Name The Name which is copied.
Source:
Returns:
This Data so that you can chain calls to update values.
Type
Data

setSignature(signature) → {Data}

Set the signature to a copy of the given signature.
Parameters:
Name Type Description
signature Signature The signature object which is cloned.
Source:
Returns:
This Data so that you can chain calls to update values.
Type
Data

wireDecode(input, wireFormat)

Decode the input using a particular wire format and update this Data. If wireFormat is the default wire format, also set the defaultWireEncoding to another pointer to the input.
Parameters:
Name Type Description
input Blob | Buffer The buffer with the bytes to decode.
wireFormat WireFormat (optional) A WireFormat object used to decode this object. If omitted, use WireFormat.getDefaultWireFormat().
Source:

wireEncode(wireFormat) → {SignedBlob}

Encode this Data for a particular wire format. If wireFormat is the default wire format, also set the defaultWireEncoding field to the encoded result.
Parameters:
Name Type Description
wireFormat WireFormat (optional) A WireFormat object used to encode this object. If omitted, use WireFormat.getDefaultWireFormat().
Source:
Returns:
The encoded buffer in a SignedBlob object.
Type
SignedBlob