Which code segment should you use?

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?

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?

A.
Dim objStream As New MemoryStream(document)Dim objDeflate As New DeflateStream(objStream, CompressionMode.Compress)Dim result(document.Length) As ByteobjDeflate.Write(result, 0,
result.Length)Return result

B.
Dim objStream As New MemoryStream(document)Dim objDeflate As New DeflateStream(objStream, CompressionMode.Compress)objDeflate.Write(document, 0, document.Length)objDeflate.Close()Return objStream.ToArray

C.
Dim objStream As New MemoryStream()Dim objDeflate As New DeflateStream(objStream, CompressionMode.Compress)objDeflate.Write(document, 0, document.Length)objDeflate.Close()Return objStream.ToArray

D.
Dim objStream As New MemoryStream()Dim objDeflate As New DeflateStream(objStream, CompressionMode.Compress)Dim outStream As New MemoryStreamDim b As IntegerWhile (b = objDeflate.ReadByte) outStream.WriteByte(CByte(b))End WhileReturn outStream.ToArray



Leave a Reply 0

Your email address will not be published. Required fields are marked *