java读取blob并用base64码进行保存
代码如下:java.sql.Blobblob=rest.getBlob("Xp");//rest为resultSetInputStreaminStream=blob.ge...
代码如下:
java.sql.Blob blob = rest.getBlob("Xp");//rest为resultSet
InputStream inStream = blob.getBinaryStream();
long nLen = blob.length();
if(nLen > 0){
int nSize = (int) nLen;
byte[] data = new byte[nSize];
inStream.read(data);
inStream.close();
String rohto = new Base64().toBase(data);
}
此处将blob转化为byte[]有问题吗?
rohto的结果开头为"////4AAQSkZJRgABAQEBZgFm",是什么问题?谢谢 展开
java.sql.Blob blob = rest.getBlob("Xp");//rest为resultSet
InputStream inStream = blob.getBinaryStream();
long nLen = blob.length();
if(nLen > 0){
int nSize = (int) nLen;
byte[] data = new byte[nSize];
inStream.read(data);
inStream.close();
String rohto = new Base64().toBase(data);
}
此处将blob转化为byte[]有问题吗?
rohto的结果开头为"////4AAQSkZJRgABAQEBZgFm",是什么问题?谢谢 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |