private void updateBuffer() throws GeneralSecurityException, IOException {
      mac.init(new SecretKeySpec(prk, getJavaxHmacName(hashType)));
      buffer.reset();
      mac.update(buffer);
      mac.update(input);
      ctr = ctr + 1;
      mac.update((byte) ctr);
      buffer = ByteBuffer.wrap(mac.doFinal());
      buffer.mark();
    }
An implementation of the HKDF pseudorandom function, as given by RFC 5869.
java_src/src/main/java/com/google/crypto/tink/subtle/prf/HkdfStreamingPrf.java