STream Reader and buffer

In my code below, is there a way I can set the readBuff dynamically?

While streamResponse.CanRead
    Dim streamRead As New StreamReader(streamResponse)
    Dim readBuff(5120) As [Char]
    Dim count As Integer = streamRead.Read(readBuff, 0, 5120)

Etc...

Open in new window

Larry Bristersr. DeveloperAsked:
Who is Participating?
 
Meir RivkinConnect With a Mentor Full stack Software EngineerCommented:
nop.
there's no Length or Size property of StreamReader
http://msdn.microsoft.com/en-us/library/system.io.streamreader_fields.aspx
if u have control of the response stream, u can decide that the 1st 4 bytes of the stream is the length.
so u read the 1st 4 bytes of the responseStream, init the array and read the rest of the stream.
0
 
Meir RivkinConnect With a Mentor Full stack Software EngineerCommented:
Dim size as Integer = 5120
Dim readBuff(size) As [Char]

Open in new window

0
 
Luis PérezSoftware Architect in .NetCommented:
Can you please explain better what's your problem?
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
Meir RivkinFull stack Software EngineerCommented:
u can use a variable instead the number when u initialize the array.
0
 
Larry Bristersr. DeveloperAuthor Commented:
Ok guys...
So there's no dynamic setting of the number based on the Stream itself?
0
 
Larry Bristersr. DeveloperAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.