Question

I am pulling binary data of .doc and .pdf compressed files out of a database. I need to be able to extract these preferably from the stream and then save them to a file location. I do not have the compressed file extension, but I have the compression methods. They are zip, zip2, and dgz. I have virtually no experience in the realm of compression. I have never even heard of dgz.
I can pull the data and write it to a file location, but I cannot extract it appropriately.
I would appreciate any help from someone smarter than myself.

String sql = "SELECT * FROM table WHERE id = '12345'";
DataSet ds = ExecuteQuery(sql, "Document"); //This simply queries the data base
byte[] myBytes = new byte[0];
myBytes = (byte[])ds.Tables[0].Rows[0]["document"];

// Need to extract the stream here

StreamWriter sWriter = new StreamWriter("../file.pdf");
BinaryWriter writer = new BinaryWriter(sWriter.BaseStream);
writer.Write(myBytes);
writer.Close();

Pas de solution correcte

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top