gfqFighting

最近学习中学习到关于c#  如何把图片用webservice传输  然后java 端接收保存,或者反之。。。

首先:要将图片转换成byte 

其次:要讲byte进行base64编码 (之前没有编码没有传输成功的) 

最后:java端接收到进行base64译码

下面贴出代码:

           c#端
            String imgpath = @"imgPath";
FileStream file = new FileStream(imgpath, FileMode.Open, FileAccess.Read);
byte[] byteArray = new byte[file.Length];
file.Read(byteArray, 0, byteArray.Length);
file.Close();
String strbaser64 = Convert.ToBase64String(byteArray);
java端
byte[] buffer = Base64.decode(bytes);
File file = new File(SDPATH + imagePath);

FileOutputStream fos = new FileOutputStream(file);

fos.write(buffer);

fos.flush();

fos.close();


如果有不不足处请大家多指点,谢谢

分类:

技术点:

相关文章:

  • 2021-11-04
  • 2021-11-04
  • 2021-11-04
  • 2021-12-22
  • 2021-09-15
  • 2021-12-22
  • 2021-11-04
猜你喜欢
  • 2021-11-04
  • 2021-11-14
  • 2021-12-22
  • 2021-12-17
  • 2021-12-22
  • 2021-11-06
  • 2021-09-18
相关资源
相似解决方案