I have a java function, and am trying to mimic the same functionality in VB.NET.
The Java function:
String text = “ABCDEFG”
int length = text.length();
int l1 = length >> 8;
int l2 = length % 256;
swriter.write(new byte[] {(byte)l1, (byte)l2});
My VB.NET Converted function:
Dim text As String = "ABCDEFG"
Dim length As Integer = text.Length
Dim l1 As Integer = length >> 8
Dim l2 As Integer = length Mod 256
Dim tempArr(2) As Byte
tempArr(0) = Convert.ToByte(l1)
tempArr(1) = Convert.ToByte(l2)
swriter.Write(tempArr)
swriter is a StreamWriter
What is is that everytime when I see the values written through streamwriter on the server shows as "System.byte[]
". I tried using BitConverter.GetBytes() function also, but it gives the same results.
What is that I am missing? And how to write the numbers as Byte format. In the above example the length of the text is 7("ABCDEFG"), however in my application it will be more than 1000.