照片存储

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);

你可能感兴趣的:(exception,String,null,存储,byte,照片)