472,119 Members | 1,903 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

Converting Byte() to String

Hi, what is the most performing way to convert a byte stream to a string?

Byte() to be converted to String.

Thanks, iBen.

Sorry if it ia a double post in this newsgroup, I cannot set my first one.
Nov 20 '05 #1
1 9447
Benoit,
Hi, what is the most performing way to convert a byte stream to a string? By a 'byte stream' do you mean a class derived from System.IO.Stream?

Use a System.IO.StreamReader class over the Stream object with the correct
encoding passed to the constructor
Byte() to be converted to String. Or are you referring to a Byte Array?

You can use the System.Text.Encoding class to convert an array of Bytes to a
String based on the encoding used in the byte array.

Dim bytes() As Byte
Dim s As String = System.Text.Encoding.Default.GetString(bytes)

Will convert the array of bytes based on the system's current ANSI code
page.
Hope this helps
Jay

"Benoit" <be*************@disfc.com> wrote in message
news:e$**************@TK2MSFTNGP11.phx.gbl... Hi, what is the most performing way to convert a byte stream to a string?

Byte() to be converted to String.

Thanks, iBen.

Sorry if it ia a double post in this newsgroup, I cannot set my first one.

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by matt melton | last post: by
4 posts views Thread by Hal Vaughan | last post: by
4 posts views Thread by Prabhu | last post: by
8 posts views Thread by Marius Cabas | last post: by
16 posts views Thread by manmit.walia | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.