Question: You work as an application developer at Certkiller .com. You are currently in the process of
creating a new
application for Certkiller .com. You are required to read compressed data files that has been
sent by
Certkiller .com's sales offices.
These data files are less than 4 GB in size, but was compressed without cyclic redundancy. You
want to
write a method that receives the compressed files and return the uncompressed data as a byte
array.
What should you do? - (VB.NET)
A
B
C
D
Use the following code:
Public Function DecompressFile(file As String) As Byte()
Dim fs As New FileStream(file, FileMode.Open)
Dim cs As New DeflateStream(fs, CompressionMode.Decompress, True)
Dim data As Byte() = New Byte(fs.Length - 2) {}
cs.Read(data, 0, data.Length)
cs.Close()
Return data
End Function
Public Function DecompressFile(file As String) As Byte()
Dim fs As New FileStream(file, FileMode.Open)
Dim cs As New DeflateStream(fs, CompressionMode.Decompress, True)
Dim data As Byte() = New Byte(fs.Length - 2) {}
cs.Read(data, 0, data.Length)
cs.Close()
Return data
End Function
B
Use the following code:
Public Function DecompressFile(file As String) As Byte()
Dim fs As New FileStream(file, FileMode.Open)
Dim cs As New GZipStream(fs, CompressionMode.Decompress)
Dim data As Byte() = New Byte(fs.Length - 2) {}
cs.Read(data, 0, data.Length)
Return data
End Function
Public Function DecompressFile(file As String) As Byte()
Dim fs As New FileStream(file, FileMode.Open)
Dim cs As New GZipStream(fs, CompressionMode.Decompress)
Dim data As Byte() = New Byte(fs.Length - 2) {}
cs.Read(data, 0, data.Length)
Return data
End Function
C
Use the following code:
Public Function DecompressFile(file As String) As Byte()
Dim fs As New FileStream(file, FileMode.Open)
Dim cs As New DeflateStream(fs, CompressionMode.Decompress)
Dim data As Byte() = New Byte(fs.Length - 2) {}
cs.Read(data, 0, data.Length)
Return data
End Function
Public Function DecompressFile(file As String) As Byte()
Dim fs As New FileStream(file, FileMode.Open)
Dim cs As New DeflateStream(fs, CompressionMode.Decompress)
Dim data As Byte() = New Byte(fs.Length - 2) {}
cs.Read(data, 0, data.Length)
Return data
End Function
D
Use the following code:
Public Function DecompressFile(file As String) As Byte()
Dim fs As New FileStream(file, FileMode.Open)
Dim cs As New GZipStream(fs, CompressionMode.Decompress, True)
Dim data As Byte() = New Byte(fs.Length - 2) {}
cs.Read(data, 0, data.Length)
cs.Close()
Return data
End Function
Public Function DecompressFile(file As String) As Byte()
Dim fs As New FileStream(file, FileMode.Open)
Dim cs As New GZipStream(fs, CompressionMode.Decompress, True)
Dim data As Byte() = New Byte(fs.Length - 2) {}
cs.Read(data, 0, data.Length)
cs.Close()
Return data
End Function
Note: Not available