Here you know that you'll get back a valid enum, so you can just do:

    EncodeFormat format = EncodeFormat.valueOf(encoding);
    switch (format) {
    case HEX:
    ...