Question:You need to write a code segment that transfers the first 80 bytes from a stream variable named
stream1
into a new byte array named byteArray.
You also need to ensure that the code segment assigns the number of bytes that are
transferred to an
integer variable
named bytesTransferred.
Which code segment should you use? - (VB.Net)
A bytesTransferred = stream1.Read(byteArray, 0, 80)
B For i As Integer = 0 To 79
stream1.WriteByte(byteArray(i))
bytesTransferred = i
If Not stream1.CanWrite Then
Exit For
End If
Next
C While bytesTransferred < 80
stream1.Seek(1, SeekOrigin.Current)
byteArray(System.Math.Max(System.Threading.Interlocked.Increment(bytesTransferred),
bytesTransferred - 1)) = Convert.ToByte(stream1.ReadByte())
End While
D stream1.Write(byteArray, 0, 80)
bytesTransferred = byteArray.Length