question: private static final void encodeRun ( StringBuffer buffer , short value , int length ) { if ( length < 4 ) { for ( int j = 0 ; j < length ; ++ j ) { if ( value == ( int ) ESCAPE ) buffer . append ( ESCAPE ) ; buffer . append ( ( char ) value ) ; } } else { if ( length == ( int ) ESCAPE ) { if ( value == ( int ) ESCAPE ) buffer . append ( ESCAPE ) ; buffer . append ( ( char ) value ) ; -- length ; } buffer . append ( ESCAPE ) ; buffer . append ( ( char ) length ) ; buffer . append ( ( char ) value ) ; } }
target:  Encode a run, possibly a degenerate run (of < 4 values).