public void writeEncodedValue(EncodedValue encodedValue) throws IOException {
        switch (encodedValue.getValueType()) {
            case ValueType.BOOLEAN:
                writeBooleanEncodedValue((BooleanEncodedValue) encodedValue);
                break;
            case ValueType.BYTE:
                writeIntegralValue(((ByteEncodedValue) encodedValue).getValue(), 't');
                break;
            case ValueType.CHAR:
                writeCharEncodedValue((CharEncodedValue) encodedValue);
                break;
            case ValueType.SHORT:
                writeIntegralValue(((ShortEncodedValue) encodedValue).getValue(), 's');
                break;
            case ValueType.INT:
                writeIntegralValue(((IntEncodedValue) encodedValue).getValue(), null);
                break;
            case ValueType.LONG:
                writeIntegralValue(((LongEncodedValue)encodedValue).getValue(), 'L');
                break;
            case ValueType.FLOAT:
                writeFloatEncodedValue((FloatEncodedValue) encodedValue);
                break;
            case ValueType.DOUBLE:
                writeDoubleEncodedValue((DoubleEncodedValue) encodedValue);
                break;
            case ValueType.ANNOTATION:
                writeAnnotation((AnnotationEncodedValue)encodedValue);
                break;
            case ValueType.ARRAY:
                writeArray((ArrayEncodedValue)encodedValue);
                break;
            case ValueType.STRING:
                writeQuotedString(((StringEncodedValue)encodedValue).getValue());
                break;
            case ValueType.FIELD:
                writeFieldDescriptor(((FieldEncodedValue)encodedValue).getValue());
                break;
            case ValueType.ENUM:
                writeEnum((EnumEncodedValue) encodedValue);
                break;
            case ValueType.METHOD:
                writeMethodDescriptor(((MethodEncodedValue)encodedValue).getValue());
                break;
            case ValueType.TYPE:
                writeType(((TypeEncodedValue)encodedValue).getValue());
                break;
            case ValueType.METHOD_TYPE:
                writeMethodProtoDescriptor(((MethodTypeEncodedValue)encodedValue).getValue());
                break;
            case ValueType.METHOD_HANDLE:
                writeMethodHandle(((MethodHandleEncodedValue)encodedValue).getValue());
                break;
            case ValueType.NULL:
                writer.write("null");
                break;
            default:
                throw new IllegalArgumentException("Unknown encoded value type");
        }
    }
@Test
    public void testWriteEncodedValue_methodType_withSpaces() throws IOException {
        BaksmaliWriter writer = new BaksmaliWriter(output);

        writer.writeEncodedValue(new ImmutableMethodTypeEncodedValue(getMethodProtoReferenceWithSpaces()));

        Assert.assertEquals(
                "(L`param with spaces 1`;L`param with spaces 2`;)Lreturn/type/`with spaces`;",
                output.toString());
    }