axis中blob類型轉string類型
//將blob類型轉成byte數組
byte[] temps = syncoa1.getPhoto().getBytes((long)1,(int)syncoa1.getPhoto().length());
//通過base64將byte類型轉成String類型
String tempRet = new BASE64Encoder().encode(temps);
//通過base64將byte類型轉成String類型
String tempRet = new BASE64Encoder().encode(temps);
注:syncoa1.getPhoto()為blob類型
//通過String轉成byte數組
byte[] bytes = new sun.misc.BASE64Decoder().decodeBuffer(tempRet);
byte[] bytes = new sun.misc.BASE64Decoder().decodeBuffer(tempRet);
//通過Hibernate提供的表態方法來實現byte數組與blob類型之間的轉換
Blob tempBlob = Hibernate.createBlob(bytes);
Blob tempBlob = Hibernate.createBlob(bytes);
本文由用戶 tiancq 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!