Code example for Blob

Methods: getBytes, length

0
		s.getTransaction().commit();
		s.close();
	} 
 
	public static byte[] extractData(Blob blob) throws Exception {
		return blob.getBytes( 1, ( int ) blob.length() );
	} 
 
 
	public static byte[] buildByteArray(long size, boolean on) {
		byte[] data = new byte[(int)size];
		data[0] = mask( on );
		for ( int i = 0; i < size; i++ ) {
			data[i] = mask( on );
			on = !on;
		} 
		return data;
	} 
 
	private static byte mask(boolean on) {
		return on ? ( byte ) 1 : ( byte ) 0;