public int setIntegerValue ( int newValue ) throws IOException , SaneException { Preconditions . checkState ( getValueCount ( ) == 1 , "option is an array" ) ; // check that this option is readable Preconditions . checkState ( isWriteable ( ) ) ; // Send RPC corresponding to: // // SANE_Status sane_control_option (SANE_Handle h, SANE_Int n, // SANE_Action a, void *v, // SANE_Int * i); ControlOptionResult result = writeOption ( ImmutableList . of ( newValue ) ) ; Preconditions . checkState ( result . getType ( ) == OptionValueType . INT ) ; Preconditions . checkState ( result . getValueSize ( ) == SaneWord . SIZE_IN_BYTES ) ; return SaneWord . fromBytes ( result . getValue ( ) ) . integerValue ( ) ; }
Set the value of the current option to the supplied value . Option value must be of integer type