11package org .lmdbjava ;
22
33import java .nio .ByteBuffer ;
4- import static java .util .Objects .requireNonNull ;
54import jnr .ffi .Pointer ;
65import jnr .ffi .byref .NativeLongByReference ;
76import org .lmdbjava .Library .MDB_val ;
87import static org .lmdbjava .Library .lib ;
98import static org .lmdbjava .Library .runtime ;
109import static org .lmdbjava .ValueBuffers .createVal ;
1110import static org .lmdbjava .ValueBuffers .wrap ;
12- import static org .lmdbjava .PutFlags .ZERO ;
1311import static org .lmdbjava .ResultCodeMapper .checkRc ;
1412import static java .util .Objects .requireNonNull ;
13+ import static org .lmdbjava .MaskedFlag .mask ;
1514
1615public class Cursor {
1716
@@ -83,15 +82,10 @@ public void delete() throws LmdbNativeException {
8382 checkRc (lib .mdb_cursor_del (ptr , 0 ));
8483 }
8584
86- public void put (ByteBuffer key , ByteBuffer val ) throws LmdbNativeException {
87- put (key , val , ZERO );
88- }
89-
90- public void put (ByteBuffer key , ByteBuffer val , PutFlags op )
85+ public void put (ByteBuffer key , ByteBuffer val , PutFlags ... op )
9186 throws LmdbNativeException {
9287 requireNonNull (key );
9388 requireNonNull (val );
94- requireNonNull (op );
9589 if (tx .isCommitted ()) {
9690 throw new IllegalArgumentException ("transaction already committed" );
9791 }
@@ -100,7 +94,8 @@ public void put(ByteBuffer key, ByteBuffer val, PutFlags op)
10094 }
10195 final MDB_val k = createVal (key );
10296 final MDB_val v = createVal (val );
103- checkRc (lib .mdb_cursor_put (ptr , k , v , op .getMask ()));
97+ final int flags = mask (op );
98+ checkRc (lib .mdb_cursor_put (ptr , k , v , flags ));
10499 }
105100
106101 public void renew (Transaction tx ) throws LmdbNativeException {
0 commit comments