Given datatype identifier, H5T_ENCODE converts a data type description into binary form in a buffer. Using this binary form in the buffer, a datatype object can be reconstructed using H5T_DECODE to return a new object handle (hid_t) for this datatype.
A preliminary H5T_ENCODE call can be made to find out the size of the buffer needed. This value is returned as
nalloc. That value can then be assigned to
nalloc for a second H5T_ENCODE call, which will retrieve the actual encoded object.
If the library finds out
nalloc is not big enough for the object, it simply returns the size of the buffer needed through
nalloc without encoding the provided buffer.