nilsimsa
nilsimsa copied to clipboard
Add update() support for partial data in input buffer
This makes it easier to update() from a data buffer, i.e. when reading from a stream.
Nilsimsa nilsimsa = new Nilsimsa();
byte buf[] = new byte[4096];
for (int len = maxlen; len > 0;) {
int bytesRead = content.read(buf, 0, Math.min(buf.length, len));
if (bytesRead < 0)
break;
nilsimsa.update(buf, 0, bytesRead); // <=== LOOK!
len -= bytesRead;
}