// Utility function to put data in a Blob
static void fillBlob (Connection conn, BLOB blob, long length)
throws Exception
{
OutputStream outstream = blob.getBinaryOutputStream();
int i = 0;
int chunk = 10;
byte [] data = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
while (i < length)
{
data [0] = (byte)i;
outstream.write(data, 0, chunk);
i += chunk;
if (length - i < chunk)
chunk = (int) length - i;
}
outstream.close();
}
}
给你这个例子看看,一看就明白了
| 广告合作:400-664-0084 全国热线:400-664-0084 Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号 珠峰网 版权所有 All Rights Reserved
|