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

lrbristerAsked:
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Meir RivkinFull stack Software EngineerCommented:
u can use a variable instead the number when u initialize the array.
0
 
lrbristerAuthor Commented:
Ok guys...
So there's no dynamic setting of the number based on the Stream itself?
0
 
lrbristerAuthor Commented:
Thanks
0
All Courses

From novice to tech pro — start learning today.