Android下载文件异常java.net.ProtocolException: unexpected end of stream

在使用HttpURLConnection下载文件的时候,如果服务器返回的Content-Length字段给出的文件长度比实际文件大小大的时候,客户端在读取流数据到达实际文件大小后,继续读取数据时,就会抛出
java.net.ProtocolException: unexpected end of stream
at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.read(HttpConnection.java:421)
at com.android.okhttp.okio.RealBufferedSource$1.read(RealBufferedSource.java:349)
at java.io.BufferedInputStream.read(BufferedInputStream.java:290)
at java.io.BufferedInputStream.read(BufferedInputStream.java:290)
……