Class ByteArrayPortability
java.lang.Object
org.terracotta.offheapstore.storage.portability.ByteArrayPortability
- All Implemented Interfaces:
Portability<byte[]>
- Direct Known Subclasses:
PersistentByteArrayPortability
A simple
byte[] portability.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]decode(ByteBuffer buffer) Decodes aByteBufferto an object of typeT.encode(byte[] object) Encodes an object of typeTas aByteBuffer.booleanequals(Object value, ByteBuffer readBuffer) Byte arrays do not have a content-based equals method so this throwsUnsupportedOperationException.
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
ByteArrayPortability
protected ByteArrayPortability()
-
-
Method Details
-
encode
Description copied from interface:PortabilityEncodes an object of typeTas aByteBuffer.- Specified by:
encodein interfacePortability<byte[]>- Parameters:
object- object to be encoded- Returns:
- the encoded object
-
decode
Description copied from interface:PortabilityDecodes aByteBufferto an object of typeT.- Specified by:
decodein interfacePortability<byte[]>- Parameters:
buffer- bytes to decode- Returns:
- the decoded object
-
equals
Byte arrays do not have a content-based equals method so this throwsUnsupportedOperationException.The lack of any implementation only prevents this portability being used as a key portability. Using byte arrays as keys in map would be extremely questionable in any case. If necessary this portability could be sub-classed to do deep array comparison.
- Specified by:
equalsin interfacePortability<byte[]>- Parameters:
value- object to compare toreadBuffer- buffer containing encoded object- Returns:
trueif the two parameters are "equal"- Throws:
UnsupportedOperationException
-