读取blob格式图片上传到服务器目录

//得到blob格式图片

String fileUrl = "url";
  Blob blob1 = vo.getPicture();
  InputStream image=null;
  if (blob1 != null && blob1.length() > 0) {
   java.io.FileOutputStream fout = null;

//写入流中
   fout = new java.io.FileOutputStream(fileUrl);
   ByteArrayOutputStream baos = new ByteArrayOutputStream();
   InputStream in =  blob1.getBinaryStream();
    int len;
             byte buf[] = new byte[1024];
        
             while ((len = in.read(buf, 0, 1024)) != -1) {
                 fout.write(buf, 0, len);              
             }
             fout.close();
           
  }

你可能感兴趣的:(java,Java)