int length = clob.getLength();
byte[] array = new byte[length];
InputStream in = clob.getAsciiStream();
int offset = 0;
int n;
do
n = in.read(array, offset, length - offset);
while (n != -1);
尝试使用上面的代码片段将 clob 读入字节数组。
int length = clob.getLength();
byte[] array = new byte[length];
InputStream in = clob.getAsciiStream();
int offset = 0;
int n;
do
n = in.read(array, offset, length - offset);
while (n != -1);
Try the above snippet of code for reading a clob into Byte array.
发布评论
评论(3)
与 commons-io
with commons-io
尝试使用上面的代码片段将 clob 读入字节数组。
Try the above snippet of code for reading a clob into Byte array.
获取 ASCII 流,然后从流中读入字节数组。 http://download.oracle.com /javase/1.4.2/docs/api/java/sql/Clob.html#getAsciiStream()
Get the ASCII stream and then read from the stream into a byte array. http://download.oracle.com/javase/1.4.2/docs/api/java/sql/Clob.html#getAsciiStream()