public final class DmtData extends Object
DmtSession interface.
 
 Different constructors are available to create nodes with different formats.
 Nodes of null format can be created using the static
 NULL_VALUE constant instance of this class.
 
 FORMAT_RAW_BINARY and FORMAT_RAW_STRING enable the support
 of future data formats. When using these formats, the actual format name is
 specified as a String. The application is responsible for the proper
 encoding of the data according to the specified format.
| Modifier and Type | Field and Description | 
|---|---|
static DmtData | 
FALSE_VALUE
Constant instance representing a boolean  
false value. | 
static int | 
FORMAT_BASE64
The node holds an OMA DM  
b64 value. | 
static int | 
FORMAT_BINARY
The node holds an OMA DM  
bin value. | 
static int | 
FORMAT_BOOLEAN
The node holds an OMA DM  
bool value. | 
static int | 
FORMAT_DATE
The node holds an OMA DM  
date value. | 
static int | 
FORMAT_DATE_TIME
The node holds a Date object. 
 | 
static int | 
FORMAT_FLOAT
The node holds an OMA DM  
float value. | 
static int | 
FORMAT_INTEGER
The node holds an OMA DM  
int value. | 
static int | 
FORMAT_LONG
The node holds a long value. 
 | 
static int | 
FORMAT_NODE
Format specifier of an internal node. 
 | 
static int | 
FORMAT_NULL
The node holds an OMA DM  
null value. | 
static int | 
FORMAT_RAW_BINARY
The node holds raw protocol data encoded in binary format. 
 | 
static int | 
FORMAT_RAW_STRING
The node holds raw protocol data encoded as  
String. | 
static int | 
FORMAT_STRING
The node holds an OMA DM  
chr value. | 
static int | 
FORMAT_TIME
The node holds an OMA DM  
time value. | 
static int | 
FORMAT_XML
The node holds an OMA DM  
xml value. | 
static DmtData | 
NULL_VALUE
Constant instance representing a leaf node of  
null format. | 
static DmtData | 
TRUE_VALUE
Constant instance representing a boolean  
true value. | 
| Constructor and Description | 
|---|
DmtData(boolean bool)
Create a  
DmtData instance of bool format and set its
 value. | 
DmtData(byte[] bytes)
Create a  
DmtData instance of bin format and set its
 value. | 
DmtData(byte[] bytes,
       boolean base64)
Create a  
DmtData instance of bin or b64 format
 and set its value. | 
DmtData(byte[] bytes,
       int format)
Create a  
DmtData instance of the specified format and set its
 value based on the given byte[]. | 
DmtData(Date date)
Create a  
DmtData instance of dateTime format with the
 given Date value. | 
DmtData(float flt)
Create a  
DmtData instance of float format and set its
 value. | 
DmtData(int integer)
Create a  
DmtData instance of int format and set its
 value. | 
DmtData(long lng)
Create a  
DmtData instance of long format and set its
 value. | 
DmtData(Object complex)
Create a  
DmtData instance of node format with the given
 object value. | 
DmtData(String string)
Create a  
DmtData instance of chr format with the given
 string value. | 
DmtData(String formatName,
       byte[] data)
Create a  
DmtData instance in FORMAT_RAW_BINARY format. | 
DmtData(String value,
       int format)
Create a  
DmtData instance of the specified format and set its
 value based on the given string. | 
DmtData(String formatName,
       String data)
Create a  
DmtData instance in FORMAT_RAW_STRING format. | 
| Modifier and Type | Method and Description | 
|---|---|
boolean | 
equals(Object obj)
Compares the specified object with this  
DmtData instance. | 
byte[] | 
getBase64()
Gets the value of a node with base 64 ( 
b64) format. | 
byte[] | 
getBinary()
Gets the value of a node with binary ( 
bin) format. | 
boolean | 
getBoolean()
Gets the value of a node with boolean ( 
bool) format. | 
String | 
getDate()
Gets the value of a node with date format. 
 | 
Date | 
getDateTime()
Gets the value of a node with  
dateTime format. | 
float | 
getFloat()
Gets the value of a node with  
float format. | 
int | 
getFormat()
Get the node's format, expressed in terms of type constants defined in
 this class. 
 | 
String | 
getFormatName()
Returns the format of this  
DmtData as String. | 
int | 
getInt()
Gets the value of a node with integer ( 
int) format. | 
long | 
getLong()
Gets the value of a node with long format. 
 | 
Object | 
getNode()
Gets the complex data associated with an interior node ( 
node
 format). | 
byte[] | 
getRawBinary()
Gets the value of a node in raw binary ( 
FORMAT_RAW_BINARY)
 format. | 
String | 
getRawString()
Gets the value of a node in raw  
String (
 FORMAT_RAW_STRING) format. | 
int | 
getSize()
Get the size of the data. 
 | 
String | 
getString()
Gets the value of a node with string ( 
chr) format. | 
String | 
getTime()
Gets the value of a node with time format. 
 | 
String | 
getXml()
Gets the value of a node with  
xml format. | 
int | 
hashCode()
Returns the hash code value for this  
DmtData instance. | 
String | 
toString()
Gets the string representation of the  
DmtData. | 
public static final int FORMAT_INTEGER
int value.public static final int FORMAT_FLOAT
float value.public static final int FORMAT_STRING
chr value.public static final int FORMAT_BOOLEAN
bool value.public static final int FORMAT_DATE
date value.public static final int FORMAT_TIME
time value.public static final int FORMAT_BINARY
bin value. The value of the node
 corresponds to the Java byte[] type.public static final int FORMAT_BASE64
b64 value. Like FORMAT_BINARY,
 this format is also represented by the Java byte[] type, the
 difference is only in the corresponding OMA DM format.
 
 This format does not affect the internal storage format of the data as
 byte[]. It is intended as a hint for the external representation
 of this data. Protocol Adapters can use this hint for their further
 processing.public static final int FORMAT_XML
xml value.public static final int FORMAT_NULL
null value. This corresponds to the Java
 null type.public static final int FORMAT_NODE
DmtData(Object) and
 getNode()). This value can be used by Java programs that
 know a specific URI understands the associated Java type. This type is
 further used as a return value of the MetaNode.getFormat() method
 for interior nodes.public static final int FORMAT_RAW_STRING
String. The
 getFormatName() method can be used to get the actual format
 name.public static final int FORMAT_RAW_BINARY
getFormatName() method can be used to get the actual format
 name.public static final int FORMAT_LONG
getFormatName() method can be
 used to get the actual format name.public static final int FORMAT_DATE_TIME
public static final DmtData NULL_VALUE
null format.public static final DmtData TRUE_VALUE
true value.public static final DmtData FALSE_VALUE
false value.public DmtData(String string)
DmtData instance of chr format with the given
 string value. The null string argument is valid.string - the string value to setpublic DmtData(Date date)
DmtData instance of dateTime format with the
 given Date value. The given Date value must be a non-null Date
 object.date - the Date object to setpublic DmtData(Object complex)
DmtData instance of node format with the given
 object value. The value represents complex data associated with an
 interior node.
 Certain interior nodes can support access to their subtrees through such complex values, making it simpler to retrieve or update all leaf nodes in a subtree.
 The given value must be a non-null immutable object.
complex - the complex data object to setpublic DmtData(String value, int format)
DmtData instance of the specified format and set its
 value based on the given string. Only the following string-based formats
 can be created using this constructor:
 FORMAT_STRING - value can be any stringFORMAT_XML - value must contain an XML fragment (the
 validity is not checked by this constructor)FORMAT_DATE - value must be parsable to an ISO 8601 calendar
 date in complete representation, basic format (pattern CCYYMMDD)FORMAT_TIME - value must be parsable to an ISO 8601 time of
 day in either local time, complete representation, basic format (pattern
 hhmmss) or Coordinated Universal Time, basic format (pattern
 hhmmssZ)null string argument is only valid if the format is string
 or XML.value - the string, XML, date, or time value to setformat - the format of the DmtData instance to be created,
        must be one of the formats specified aboveIllegalArgumentException - if format is not one of the
         allowed formats, or value is not a valid string for the
         given formatNullPointerException - if a string, XML, date, or time is
         constructed and value is nullpublic DmtData(int integer)
DmtData instance of int format and set its
 value.integer - the integer value to setpublic DmtData(float flt)
DmtData instance of float format and set its
 value.flt - the float value to setpublic DmtData(long lng)
DmtData instance of long format and set its
 value.lng - the long value to setpublic DmtData(boolean bool)
DmtData instance of bool format and set its
 value.bool - the boolean value to setpublic DmtData(byte[] bytes)
DmtData instance of bin format and set its
 value.bytes - the byte array to set, must not be nullNullPointerException - if bytes is nullpublic DmtData(byte[] bytes,
       boolean base64)
DmtData instance of bin or b64 format
 and set its value. The chosen format is specified by the base64
 parameter.bytes - the byte array to set, must not be nullbase64 - if true, the new instance will have b64
        format, if false, it will have bin formatNullPointerException - if bytes is nullpublic DmtData(byte[] bytes,
       int format)
DmtData instance of the specified format and set its
 value based on the given byte[]. Only the following
 byte[] based formats can be created using this constructor:
 
 bytes - the byte array to set, must not be nullformat - the format of the DmtData instance to be created, must be
        one of the formats specified aboveIllegalArgumentException - if format is not one of the allowed
         formatsNullPointerException - if bytes is nullpublic DmtData(String formatName, String data)
DmtData instance in FORMAT_RAW_STRING format.
 The data is provided encoded as a String. The actual data format
 is specified in formatName. The encoding used in data
 must conform to this format.formatName - the name of the format, must not be nulldata - the data encoded according to the specified format, must not
        be nullNullPointerException - if formatName or data is
         nullpublic DmtData(String formatName, byte[] data)
DmtData instance in FORMAT_RAW_BINARY format.
 The data is provided encoded as binary. The actual data format is
 specified in formatName. The encoding used in data must
 conform to this format.formatName - the name of the format, must not be nulldata - the data encoded according to the specified format, must not
        be nullNullPointerException - if formatName or data is
         nullpublic String getString()
chr) format.DmtIllegalStateException - if the format of the node is not stringpublic String getDate()
CCYYMMDD).DmtIllegalStateException - if the format of the node is not datepublic String getTime()
hhmmss
 ) or Coordinated Universal Time, basic format (pattern hhmmssZ).DmtIllegalStateException - if the format of the node is not timepublic Date getDateTime()
dateTime format.DmtIllegalStateException - if the format of the node is not timepublic String getXml()
xml format.DmtIllegalStateException - if the format of the node is not
         xmlpublic int getInt()
int) format.DmtIllegalStateException - if the format of the node is not integerpublic long getLong()
DmtIllegalStateException - if the format of the node is not longpublic float getFloat()
float format.DmtIllegalStateException - if the format of the node is not
         floatpublic boolean getBoolean()
bool) format.DmtIllegalStateException - if the format of the node is not booleanpublic byte[] getBinary()
bin) format.DmtIllegalStateException - if the format of the node is not binarypublic byte[] getRawBinary()
FORMAT_RAW_BINARY)
 format.DmtIllegalStateException - if the format of the node is not raw
         binarypublic String getRawString()
String (
 FORMAT_RAW_STRING) format.String formatDmtIllegalStateException - if the format of the node is not raw
         Stringpublic byte[] getBase64()
b64) format.DmtIllegalStateException - if the format of the node is not base
         64.public Object getNode()
node
 format).
 Certain interior nodes can support access to their subtrees through complex values, making it simpler to retrieve or update all leaf nodes in the subtree.
DmtIllegalStateException - if the format of the data is not
         nodepublic int getFormat()
public String getFormatName()
DmtData as String. For the
 predefined data formats this is the OMA DM defined name of the format.
 For FORMAT_RAW_STRING and FORMAT_RAW_BINARY this is the
 format specified when the object was created.Stringpublic int getSize()
FORMAT_STRING, FORMAT_XML, FORMAT_BINARY,
 FORMAT_BASE64, FORMAT_RAW_STRING, and
 FORMAT_RAW_BINARY: the length of the stored data, or 0 if the
 data is nullFORMAT_INTEGER and FORMAT_FLOAT: 4FORMAT_LONG and FORMAT_DATE_TIME: 8FORMAT_DATE and FORMAT_TIME: the length of the date
 or time in its string representationFORMAT_BOOLEAN: 1FORMAT_NODE: -1 (unknown)FORMAT_NULL: 0public String toString()
DmtData. This method works
 for all formats.
 
 For string format data - including FORMAT_RAW_STRING - the
 string value itself is returned, while for XML, date, time, integer,
 float, boolean, long and node formats the string form of the value is
 returned. Binary - including FORMAT_RAW_BINARY - base64 data is
 represented by two-digit hexadecimal numbers for each byte separated by
 spaces. The NULL_VALUE data has the string form of "
 null". Data of string or XML format containing the Java
 null value is represented by an empty string. DateTime data is
 formatted as yyyy-MM-dd'T'HH:mm:SS'Z').
public boolean equals(Object obj)
DmtData instance. Two
 DmtData objects are considered equal if their format is the same,
 and their data (selected by the format) is equal.
 
 In case of FORMAT_RAW_BINARY and FORMAT_RAW_STRING the
 textual name of the data format - as returned by getFormatName()
 - must be equal as well.
Copyright © OSGi Alliance (2000, 2015). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0