Update DiskCache.java

This commit is contained in:
Andrea Cavalli 2021-03-09 03:10:50 +01:00
parent f460657753
commit ca95c606bb

View File

@ -128,8 +128,9 @@ public class DiskCache implements URLsDiskHandler, URLsWriter {
if (blockOffset + blockLength > meta.getSize()) {
throw new IllegalStateException("Overflowed data size");
}
} else if (data.length != BLOCK_SIZE) {
throw new IllegalStateException("Block data length != block length");
} else {
// Intermediate blocks must be of max size
assert data.length == BLOCK_SIZE;
}
return new DataBlock(blockOffset, blockLength, ByteBuffer.wrap(data, 0, blockLength));
});