ObjectUtils
Path
com.roma.apic.livedata.common.v1.ObjectUtils
Description
This class is used to serialize a Java object into a byte array or deserialize a Java object from a byte array.
Example
1 2 3 4 5 6 |
importClass(com.roma.apic.livedata.common.v1.ObjectUtils); function execute(data) { var sourceCode = "Hello world"; var bytes = ObjectUtils.getBytes(sourceCode); return ObjectUtils.getObjectFromBytes(bytes) } |
Method List
Returned Type |
Method and Description |
---|---|
static byte[] |
getBytes(Object obj) Serialize objects into byte arrays. |
static Object |
getObjectFromBytes(byte[] objBytes) Deserialize byte arrays into objects. |
static int |
size(Object obj) Obtains the size of an object. |
Method Details
- public static byte[] getBytes(Object obj)
Serialize objects into byte arrays.
Input Parameter
obj indicates an object.
Returns
Byte array serialized from an object.
Throws
java.io.IOException
- public static Object getObjectFromBytes(byte[] objBytes)
Deserialize byte arrays into objects.
Input Parameter
objBytes indicates a byte array.
Returns
Serialized object.
Throws
java.io.IOException
- public static int size(Object obj)
Obtain the size of an object.
Input Parameter
obj indicates an object.
Returns
Size of the object.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot