public static byte[] blob2Bytes(Blob blob) {
        if (blob == null) {
            return null;
        }

        try {
            return blob.getBytes(1, (int) blob.length());
        } catch (Exception e) {
            throw new ShouldNeverHappenException(e);
        }
    }
@Test
    public void testBlob2Bytes() throws UnsupportedEncodingException, SQLException {
        assertNull(BlobUtils.blob2Bytes(null));
        byte[] bs = "xxaaadd".getBytes(Constants.DEFAULT_CHARSET_NAME);
        assertThat(BlobUtils.blob2Bytes(new SerialBlob(bs))).isEqualTo(
                bs);
    }