@Override
    public byte[] convert() {
        ByteBuffer inBuf = ByteBuffer.wrap(data);
        inBuf.order(ByteOrder.BIG_ENDIAN);
        inBuf.clear();

        ByteBuffer dataBuf = ByteBuffer.allocate(data.length * 2);
        dataBuf.order(ByteOrder.BIG_ENDIAN);
        dataBuf.clear();

        while (inBuf.hasRemaining()) {
            short value = inBuf.getShort();
            if((value > REPLACE_CHARACTER_START && value < REPLACE_CHARACTER_END) || value == ESCAPE_CHARACTER ) {
                dataBuf.putShort(ESCAPE_CHARACTER);
                value ^= XOR_CHARACTER;
            }
            dataBuf.putShort(value);
        }

        dataBuf.flip();
        byte[] outData = new byte[dataBuf.limit()];
        dataBuf.get(outData);

        return outData;
    }