read bytes fully

This commit is contained in:
REAndroid 2023-01-11 05:41:27 -05:00
parent dbfb08700f
commit 09268d178b

View File

@ -110,9 +110,16 @@ public abstract class BlockItem extends Block {
if(bts==null || bts.length==0){ if(bts==null || bts.length==0){
return 0; return 0;
} }
int readLength = inputStream.read(bts, 0, bts.length); int length=bts.length;
int offset=0;
int read=length;
while (length>0 && read>0){
read = inputStream.read(bts, offset, length);
length-=read;
offset+=read;
}
onBytesChanged(); onBytesChanged();
super.notifyBlockLoad(); super.notifyBlockLoad();
return readLength; return bts.length;
} }
} }