照片存储

来源:互联网 发布:软件开发月薪多少 编辑:程序博客网 时间:2024/04/28 20:52
String base64Str = null;
   if ((currentUser.getPhotoid() != null)
     && (!currentUser.getPhotoid().trim().equals(""))) {
    TUmPhoto tumPhoto = (TUmPhoto) this.dao.getObject(
      TUmPhoto.class, currentUser.getPhotoid());
    byte[] currentPhoto = null;
    if ((tumPhoto != null)
      && (!"".equals(tumPhoto.getPid().trim()))) {
     try {
      SerializableBlob blob = (SerializableBlob) tumPhoto
        .getUserphoto();
      BLOB blob2 = (BLOB) blob.getWrappedBlob();
      currentPhoto = blob2.getLocator();
     } catch (Exception e) {
      e.printStackTrace();
     }
     base64Str = new sun.misc.BASE64Encoder()
       .encode(currentPhoto);
    }
   }
   targetRequest.setPhoto(base64Str);
原创粉丝点击