java
import java.sql.Clob;
 
import javax.sql.rowset.serial.SerialClob;
 
 
    /**
     * Clob 转 String
     */
    public static String getString(Clob c) {
        try {
            return c.getSubString(1, (int) c.length());
        } catch (Exception e) {
            return null;
        }
    }
 
    /**
     * String 转 Clob
     */
    public static Clob getClob(String s) {
        try {
            return new SerialClob(s.toCharArray());
        } catch (Exception e) {
            return null;
        }
    }
public static String toBinary(String str){ //把字符串转成字符数组 char[] strChar=str.toCharArray(); String result=""; for(int i=0;i<strChar.length;i++){ //toBinaryString(int i)返回变量的二进制表示的字符串 //toHexString(int i) 八进制 //toOctalString(int i) 十六进制 result +=Integer.toBinaryString(strChar[i])+ " "; } return result; }
public static String toString(String binary) { String[] tempStr=binary.split(" "); char[] tempChar=new char[tempStr.length]; for(int i=0;i<tempStr.length;i++) { tempChar[i]=BinstrToChar(tempStr[i]); } return String.valueOf(tempChar); }
本文作者:Weee
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!