You are writing a method to compress an array of bytes. The bytes to be compressed are passed
to the method in a parameter named document.
You need to compress the contents of the incoming parameter.
Which code segment should you use?
A. Dim inStream As New MemoryStream(document)Dim zipStream As New
GZipStream( _inStream, CompressionMode.Compress)Dim result(document.Length) As
BytezipStream.Write(result, 0, result.Length)Return result
B. Dim objStream As New MemoryStream(document)Dim zipStream As New
GZipStream( _
objStream, CompressionMode.Compress)zipStream.Write(document, 0,
document.Length)zipStream.Close()Return objStream.ToArray
C. Dim outStream As New MemoryStreamDim zipStream As New GZipStream(
_outStream, CompressionMode.Compress)zipStream.Write(document, 0,
document.Length)zipStream.Close()Return outStream.ToArray
D. Dim objStream As New MemoryStream(document)Dim zipStream As New
GZipStream( _objStream, CompressionMode.Compress)Dim outStream As New
MemoryStreamDim b As IntegerWhile (b =
zipStream.ReadByte)outStream.WriteByte(CByte(b))End WhileReturn
outStream.ToArray
Answer: C
No comments:
Post a Comment