OutputStream outStream = this.getClob((Long) listid.get(i)).getAsciiOutputStream();
InputStream input = (InputStream) list.get(i);
byte[] buffer = new byte[input.available()];
String str = new String(buffer, "GBK");
byte buffers[] = str.getBytes();
ByteArrayInputStream bais = new ByteArrayInputStream(buffers); int coun = 0;
while ((coun = input.read(buffers)) > 0) {
outStream.write(buffers, 0, coun);
}
outStream.close();
bais.close();

解决方案 »

  1.   

    处理Clob还得考虑数据库端支持什么字符集的问题还不如直接用Blob,让数据库别考虑字符集和转码了。
      

  2.   


    我oracle的编码是SIMPLIFIED CHINESE_CHINA.ZHS16GBK,为什么还出现乱码呢?怎么解决呢?
      

  3.   

    那么就慢慢来排查。首先,直接用数据库工具,去看看数据库中Clob字段中的内容,是不是乱码。
    至少要保证你写进去的时候,信息是正确的。然后才是检查在读取的时候,所选择的转码方式是否合适。