JAVA에서 C# webapi를 사용하고 있습니다. API 메소드는 파일 바이트 배열을 반환합니다. 자바에서 바이트 배열 응답을 읽을 수 있지만 같은 파일로 변환하려고하면 전체 문자열을 파일에 씁니다. 다음은 DOCX file screenshotapi httpresponse bytearray를 파일로 변환하십시오.
이 피들러 응답 스크린 샷입니다 : 아래
HttpResponse response=...
byte[] content = EntityUtils.toByteArray(response.getEntity());
File fileToWriteTo = new File("abc.docx");
FileUtils.writeByteArrayToFile(fileToWriteTo, content);
가 생성 된 파일의 스크린 샷입니다 : 아래
내가 사용하고있는 코드입니다
Fiddler response screenshot
답장을 보내 주셔서 감사합니다. 너는 나를 위해 일한다. –