Package com.gigaspaces.internal.utils
Class ByteUtils
java.lang.Object
com.gigaspaces.internal.utils.ByteUtils
Convenient methods for converting objects to and from bytes.
- Since:
- 7.0
- Author:
- Moran Avigdor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectbytesToObject(byte[] bytes) Convert a byte array into an object.static byte[]objectToBytes(Object obj) Convert an object into byte array.
-
Constructor Details
-
ByteUtils
public ByteUtils()
-
-
Method Details
-
objectToBytes
Convert an object into byte array.- Parameters:
obj- an object that implementsSerializable- Returns:
- a byte array representing this object.
- Throws:
IOException- if an I/O error occurs while writing stream header.
-
bytesToObject
Convert a byte array into an object.- Parameters:
bytes- a byte array representing the object.- Returns:
- an object.
- Throws:
IOException- if an I/O error occurs while reading stream header.ClassNotFoundException- Class of a serialized object cannot be found
-