package com.chenyang.nse.bussiness.webtools.tools.jdbc;

import java.io.IOException;
import java.io.Reader;
import java.sql.Clob;
import java.sql.SQLException;

public class ClobUtil {
   public static String getBase64FromClob(Object objDate) throws IOException {
      StringBuilder builder = new StringBuilder();
      Clob clob = (Clob)objDate;

      try {
         if (null != clob) {
            Reader rd = clob.getCharacterStream();
            char[] str = new char[12];

            while(rd.read(str) != -1) {
               builder.append(new String(str));
            }
         }
      } catch (SQLException e) {
         e.printStackTrace();
      }

      return builder.toString();
   }
}
