fix read bytes fully

This commit is contained in:
REAndroid 2023-01-10 12:59:33 -05:00
parent 6273ae33ec
commit 14eb36d3b4

View File

@ -64,10 +64,10 @@ public class AnyHeader extends HeaderBlock{
byte[] buffer = new byte[chunkSize]; byte[] buffer = new byte[chunkSize];
int length = chunkSize - headerSize; int length = chunkSize - headerSize;
int offset = loadHeaderBytes(buffer); int offset = loadHeaderBytes(buffer);
int readLength = inputStream.read(buffer, offset, length); while (length>0){
if(readLength < length){ int len = inputStream.read(buffer, offset, length);
throw new IOException("Read length is less than expected: length=" length=length-len;
+chunkSize+", read="+readLength); offset=offset+len;
} }
return buffer; return buffer;
} }