@Override
    void toBinary(BinaryPropertyListWriter out) throws IOException {
        switch (type()) {
            case INTEGER: {
                if (longValue() < 0) {
                    out.write(0x13);
                    out.writeBytes(longValue(), 8);
                } else if (longValue() <= 0xff) {
                    out.write(0x10);
                    out.writeBytes(longValue(), 1);
                } else if (longValue() <= 0xffff) {
                    out.write(0x11);
                    out.writeBytes(longValue(), 2);
                } else if (longValue() <= 0xffffffffL) {
                    out.write(0x12);
                    out.writeBytes(longValue(), 4);
                } else {
                    out.write(0x13);
                    out.writeBytes(longValue(), 8);
                }
                break;
            }
            case REAL: {
                out.write(0x23);
                out.writeDouble(doubleValue());
                break;
            }
            case BOOLEAN: {
                out.write(boolValue() ? 0x09 : 0x08);
                break;
            }
        }
    }