为此,您可以使用
TypedByteArray
您的翻新服务将如下所示:
@POST("/send")void upload(@Body TypedInput bytes, Callback<String> cb);您的客户代码:
byte[] byteArray = ... TypedInput typedBytes = new TypedByteArray("application/octet-stream", byteArray); remoteService.upload(typedBytes, new Callback<String>() { @Override public void success(String s, Response response) { //Success Handling } @Override public void failure(RetrofitError retrofitError) { //Error Handling } });“应用程序/八位字节流”-代替此MIME-
TYPE,您可能要使用数据格式类型。您可以在这里找到详细信息:http : //www.freeformatter.com/mime-types-
list.html
和Spring MVC控制器(如果需要):
@RequestMapping(value = "/send", method = RequestMethod.POST)public ResponseEntity<String> receive(@RequestBody byte[] data) { //handle data return new ResponseEntity<>(HttpStatus.CREATED);}

![如何在改造中发送byte []数组 如何在改造中发送byte []数组](http://www.mshxw.com/aiimages/31/595728.png)
