Exemple #1
0
  /** java.security.MessageDigestSpi#engineUpdate(ByteBuffer) */
  public void test_engineUpdateLjava_nio_ByteBuffer() {
    MyMessageDigest md = new MyMessageDigest();
    byte[] b = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

    ByteBuffer buf = ByteBuffer.wrap(b, 0, b.length);
    buf.get(b);
    int limit = buf.limit();
    md.engineUpdate(buf);
    assertEquals(limit, buf.limit());
    assertEquals(limit, buf.position());

    buf = ByteBuffer.wrap(b, 0, b.length);
    buf.get();
    buf.get();
    buf.get();
    md.engineUpdate(buf);
    assertEquals(limit, buf.limit());
    assertEquals(limit, buf.position());
  }