StatefulDecoder decoder = new SnickersDecoder() ;  final Object[] decoded = new Object[1] ;  decoder.setCallback( new DecoderCallback() { public void decodeOccurred( StatefulDecoder decoder, Object obj ) { decoded[0] = obj ; } });
StatefulDecoder decoder = ( StatefulDecoder ) decoders.get( key ) ;
    public Object decode( ByteBuffer buffer ) throws DecoderException    {        // replace this decoder with a real one later        StatefulDecoder decoder = new SnickersDecoder() ;        // used array to set a value on final variable and get by compiler        final Object[] decoded = new Object[1] ;                decoder.setCallback( new DecoderCallback()         {            public void decodeOccurred( StatefulDecoder decoder, Object obj )            {                decoded[0] = obj ;            }        });                // force synchronous callback         decoder.decode( buffer ) ;                // the decoded value should be set        if ( decoded[0] == null )        {            throw new DecoderException( "Expected a complete encoded unit of "                    + "data but got a partial" ) ;        }                return decoded[0] ;    }