package com.sino.publicclass.util;

public class BLOBObject {
	
	public static String ConvertBLOBtoString(oracle.sql.BLOB BlobContent)  
	{  
		byte[] msgContent= BlobContent.getBytes(); //BLOB转换为字节数组  
		byte[] bytes; //BLOB临时存储字节数组  
		String newStr = ""; //返回字符串  
		int i=1; //循环变量  
		long BlobLength; //BLOB字段长度  
		try  
		{  
			BlobLength=BlobContent.length(); //获取BLOB长度  
			if (msgContent == null || BlobLength==0) //如果为空，返回空值  
			{  
				return "";  
			}  
			else //处理BLOB为字符串  
			{  
				newStr = new String(BlobContent.getBytes(1,900),"utf-8"); //简化处理，只取前900字节  
				return newStr;  
			}  
		}catch(Exception e) //oracle异常捕获  
		{  
			e.printStackTrace();  
		}   
		return newStr;  
	}  

}
