package com.ejie.ab61.comun.utilidades;

import java.sql.Blob;
import java.sql.SQLException;

public class BlobUtils {

	/**
	 * Convierto un Blob a un byte[]
	 * 
	 * @param blob
	 * @return byte[]
	 */
	public static byte[] ConvertBlobToByte(Blob blob) {
		byte[] raw = null;

		try {
			if (blob != null) {
				raw = blob.getBytes(1, (int) blob.length());
			}
		} catch (SQLException e) {
			return null;
		} catch (Throwable e) {
			return null;
		}

		return raw;
	}

}