|
@@ -193,8 +193,15 @@ public class HttpClientUtil {
|
|
|
entity.setContentType("application/json");
|
|
|
HttpResponse httpResponse = client.execute(httpost);
|
|
|
String guid = httpResponse.getHeaders("guid")[0].getValue();
|
|
|
- HttpEntity entity2 = httpResponse.getEntity();
|
|
|
- byte[] data = EntityUtils.toByteArray(entity2);
|
|
|
+ InputStream is = httpResponse.getEntity().getContent();
|
|
|
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
|
|
+ int b = -1;
|
|
|
+ while ((b = is.read()) != -1) {
|
|
|
+ baos.write(b);
|
|
|
+ }
|
|
|
+ baos.close();
|
|
|
+ is.close();
|
|
|
+ byte[] data = baos.toByteArray();
|
|
|
BASE64Encoder encoder = new BASE64Encoder();
|
|
|
String imageBase64 = "data:image/png;base64," + encoder.encodeBuffer(data).trim();
|
|
|
imageBase64 = imageBase64.replaceAll("\n", "").replaceAll("\r", "").replaceAll(" ", "");
|