tags:

views:

73

answers:

0

I am writing string and int values in an array ob bytes with c#.

writeUTF(String ) in Java is giving me other results as the write(String) method on C#.

I need to modify C# so that both gives the same result.

Is there other write() method on C# Working like this Method in Java?

WriteUTF(String) Writes a string to the underlying output stream using modified UTF-8 encoding in a machine-independent manner. First, two bytes are written to the output stream as if by the writeShort method giving the number of bytes to follow. This value is the number of bytes actually written out, not the length of the string. Following the length, each character of the string is output, in sequence, using the modified UTF-8 encoding for the character. If no exception is thrown, the counter written is incremented by the total number of bytes written to the output stream. This will be at least two plus the length of str, and at most two plus thrice the length of str.

Here are an Example to compare. First java output then C# output

writeUtf(„myUserName“) 
01010912185115101114110971091
 1010912185115101114110971091