Added whole flow of encoding route segment (the encoding process is on java side).