Posted By

lfbarbieri on 01/22/07


Tagged

conversion stream ByteArray


Versions (?)

Stream to Byte Array


 / Published in: VB.NET
 

  1. Private Function GetStreamAsByteArray(ByVal stream As System.IO.Stream) As Byte()
  2.  
  3. Dim streamLength As Integer = Convert.ToInt32(stream.Length)
  4.  
  5. Dim fileData As Byte() = New Byte(streamLength) {}
  6.  
  7. ' Read the file into a byte array
  8. stream.Read(fileData, 0, streamLength)
  9. stream.Close()
  10.  
  11. Return fileData
  12.  
  13. End Function

Report this snippet  

You need to login to post a comment.