public class ByteArrayPortability extends Object implements Portability<byte[]>
byte[] portability.| Modifier and Type | Field and Description |
|---|---|
static ByteArrayPortability |
INSTANCE |
| Modifier | Constructor and Description |
|---|---|
protected |
ByteArrayPortability() |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
decode(ByteBuffer buffer)
Decodes a
ByteBuffer to an object of type T. |
ByteBuffer |
encode(byte[] object)
Encodes an object of type
T as a ByteBuffer. |
boolean |
equals(Object value,
ByteBuffer readBuffer)
Byte arrays do not have a content-based equals method so this throws
UnsupportedOperationException. |
public static final ByteArrayPortability INSTANCE
public ByteBuffer encode(byte[] object)
PortabilityT as a ByteBuffer.encode in interface Portability<byte[]>object - object to be encodedpublic byte[] decode(ByteBuffer buffer)
PortabilityByteBuffer to an object of type T.decode in interface Portability<byte[]>buffer - bytes to decodepublic boolean equals(Object value, ByteBuffer readBuffer) throws UnsupportedOperationException
UnsupportedOperationException.
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.
equals in interface Portability<byte[]>value - object to compare toreadBuffer - buffer containing encoded objecttrue if the two parameters are "equal"UnsupportedOperationExceptionCopyright © 2015–2024. All rights reserved.