возникает проблема при записи большого видеофайла с помощью httpurlconnection.
java.io.IOException: unexpected end of stream on Connection{192.1.4.55, [email protected] hostAddress=192.1.4.55 cipherSuite=none protocol=http/1.1} (recycle count=0)
W/System.err: at com.android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:210)W/System.err: at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
W/System.err: at com.android.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:904)
W/System.err: at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:788)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:443)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:388)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:501)
Код ответа здесь
final InputStream is = connection.getInputStream();
final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
final byte[] buffer = new byte[maxBufferSize];
int bytesRead;
while ((bytesRead = is.read(buffer, 0, 1024)) != -1) {
bytes.write(buffer, 0, bytesRead);
}
log.log(INFO,
format("{0} took {4} ms", url,
(currentTimeMillis() - start)));
String response = new String(bytes.toByteArray());