public void writeEncodedValue(EncodedValue encodedValue) throws IOException {
        switch (encodedValue.getValueType()) {
            case ValueType.BOOLEAN:
                writer.write(Boolean.toString(((BooleanEncodedValue) encodedValue).getValue()));
                break;
            case ValueType.BYTE:
                writer.write(
                        String.format("0x%x", ((ByteEncodedValue)encodedValue).getValue()));
                break;
            case ValueType.CHAR:
                writer.write(
                        String.format("0x%x", (int)((CharEncodedValue)encodedValue).getValue()));
                break;
            case ValueType.SHORT:
                writer.write(
                        String.format("0x%x", ((ShortEncodedValue)encodedValue).getValue()));
                break;
            case ValueType.INT:
                writer.write(
                        String.format("0x%x", ((IntEncodedValue)encodedValue).getValue()));
                break;
            case ValueType.LONG:
                writer.write(
                        String.format("0x%x", ((LongEncodedValue)encodedValue).getValue()));
                break;
            case ValueType.FLOAT:
                writer.write(Float.toString(((FloatEncodedValue)encodedValue).getValue()));
                break;
            case ValueType.DOUBLE:
                writer.write(Double.toString(((DoubleEncodedValue)encodedValue).getValue()));
                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:
                writeFieldDescriptor(((EnumEncodedValue)encodedValue).getValue());
                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_double() throws IOException {
        DexFormattedWriter writer = new DexFormattedWriter(output);

        writer.writeEncodedValue(new ImmutableDoubleEncodedValue(12.34));

        Assert.assertEquals("12.34", output.toString());
    }