private void writeValue ( Object value ) throws JSONException { if ( value instanceof Number ) { String string = JSONObject . numberToString ( ( Number ) value ) ; int integer = this . valuekeep . find ( string ) ; if ( integer != none ) { write ( 2 , 2 ) ; write ( integer , this . valuekeep ) ; return ; } if ( value instanceof Integer || value instanceof Long ) { long longer = ( ( Number ) value ) . longValue ( ) ; if ( longer >= 0 && longer < int14 ) { write ( 0 , 2 ) ; if ( longer < int4 ) { zero ( ) ; write ( ( int ) longer , 4 ) ; return ; } one ( ) ; if ( longer < int7 ) { zero ( ) ; write ( ( int ) ( longer - int4 ) , 7 ) ; return ; } one ( ) ; write ( ( int ) ( longer - int7 ) , 14 ) ; return ; } } write ( 1 , 2 ) ; for ( int i = 0 ; i < string . length ( ) ; i += 1 ) { write ( bcd ( string . charAt ( i ) ) , 4 ) ; } write ( endOfNumber , 4 ) ; this . valuekeep . register ( string ) ; } else { write ( 3 , 2 ) ; writeJSON ( value ) ; } }
Write a value .