if (object instanceof byte[]) {
bytes = (byte[])object;
}
else {
ByteSource source = (ByteSource) object;
byte[] srcArray = source.byteArray();
int offset = source.byteArrayOffset();
int end = offset + source.byteArrayLength();
bytes = Arrays.copyOfRange(srcArray, offset, end);
}
type = MBinary.VARBINARY.instance(bytes.length, false);