Question:You are writing a method to compress an array of bytes.
The array is passed to the method in a parameter named document.
You need to compress the incoming array of bytes and return the result as an array of bytes.
Which code segment should you use? - (VB.Net) 

A Dim strm As New MemoryStream(document)
Dim deflate As New DeflateStream(strm, CompressionMode.Compress)
Dim result As Byte() = New Byte(document.Lenght - 1) {}
deflate.Write(result, 0, result.Lenght)
Return result 

B Dim strm As New MemoryStream(document)
Dim deflate As New DeflateStream(strm, CompressionMode.Compress)
deflate.Write(document, 0, document.Lenght)
deflate.Close()
Return strm.ToArray() 

C Dim strm As New MemoryStream()
Dim deflate As New DeflateStream(strm, CompressionMode.Compress)
deflate.Write(document, 0, document.Lenght)
deflate.Close()
Return strm.ToArray() 

D Dim inStream As New MemoryStream(document)
Dim deflate As New DeflateStream(inStream, CompressionMode.Compress)
Dim outStream As New MemoryStream()
Dim b As Integer
While (InlineAssignHelper(b, deflate.ReadByte())) <> -1
outStream.WriteByte(CByte(b))
End While
Return outStream.ToArray() 

+ Answer
+ Report
Total Preview: 1014

Copyright © 2024. Powered by Intellect Software Ltd