473,666 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to zip a stream

ad
I want to uplad a dataset to server by WebService,
But the dataset is to huge (50 fields in 50000 rows)
I want to compress it before upload,
Now my steps are
In Client
1. DataSet1.WriteX ml("c:\my.xml" )
2. Zip c:\my.xml to my.zip
3. Delete my.xml
4. Reade my.zip into FileSteam
5. Write the FileStream to Byte[]
6.Upload Byte[] by WebService

In Server
7. Save the Byte[] to disk files (my.zip)
8. unzip my.zip to my.xml
9. delete my.zip
10. Reade my.xml to a DataSet
11 Bulk copy Dataset to DataBase Server.

It is to tedious.
I want to change to
In Clinet
1. DataSet1.WriteX ml(Stream myStream)
2. zip myStream.
3. Write myStream to Byte[]
4. Upload Byte[] by WebService

In Server
5 Write Byte[] to Stream
6. unzip Stream
7. read the stream into a DataSet
8 Bulk copy to Database Server.
But the problem is :
How to zip/unzip Stream?
or How to zip/unzip Byte[]?

How can I do that?

Nov 17 '05 #1
5 12684
ad
Thanks,
But how to use SharpZipLib to zip/unzip Stream?

"Truong Hong Thi" <th*****@gmail. com>
???????:11***** *************** **@g43g2000cwa. googlegroups.co m...
Have you tried #ziplib at
http://www.icsharpcode.net/OpenSource/SharpZipLib?

Regards,
Thi - http://thith.blogspot.com

Nov 17 '05 #3
You can compress/decompress on the fly with GZipStream in 2.0.

--
William Stacey [MVP]

"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:um******** ******@TK2MSFTN GP11.phx.gbl...
I want to uplad a dataset to server by WebService,
But the dataset is to huge (50 fields in 50000 rows)
I want to compress it before upload,
Now my steps are
In Client
1. DataSet1.WriteX ml("c:\my.xml" )
2. Zip c:\my.xml to my.zip
3. Delete my.xml
4. Reade my.zip into FileSteam
5. Write the FileStream to Byte[]
6.Upload Byte[] by WebService

In Server
7. Save the Byte[] to disk files (my.zip)
8. unzip my.zip to my.xml
9. delete my.zip
10. Reade my.xml to a DataSet
11 Bulk copy Dataset to DataBase Server.

It is to tedious.
I want to change to
In Clinet
1. DataSet1.WriteX ml(Stream myStream)
2. zip myStream.
3. Write myStream to Byte[]
4. Upload Byte[] by WebService

In Server
5 Write Byte[] to Stream
6. unzip Stream
7. read the stream into a DataSet
8 Bulk copy to Database Server.
But the problem is :
How to zip/unzip Stream?
or How to zip/unzip Byte[]?

How can I do that?

Nov 17 '05 #4

"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:ug******** *****@TK2MSFTNG P09.phx.gbl...
Thanks,
But how to use SharpZipLib to zip/unzip Stream?


There are two classes to do this in the ICSharpCode.Sha rpZIpLib.Zip
namespace: ZipInputStream and ZipOutputStream . You can write to the
ZipOutputStream to compress the output and read from the ZipInputStream.
They should both wrap other streams to make doing this easier.

The the docs should have sufficent examples to figure out how to use it from
this point.
Nov 17 '05 #5
ad
Thanks,

Could you give me an example?

"William Stacey [MVP]" <wi************ @gmail.com> ¼¶¼g©ó¶l¥ó·s»D: up************* **@TK2MSFTNGP15 .phx.gbl...
You can compress/decompress on the fly with GZipStream in 2.0.

--
William Stacey [MVP]

"ad" <fl****@wfes.tc c.edu.tw> wrote in message
news:um******** ******@TK2MSFTN GP11.phx.gbl...
I want to uplad a dataset to server by WebService,
But the dataset is to huge (50 fields in 50000 rows)
I want to compress it before upload,
Now my steps are
In Client
1. DataSet1.WriteX ml("c:\my.xml" )
2. Zip c:\my.xml to my.zip
3. Delete my.xml
4. Reade my.zip into FileSteam
5. Write the FileStream to Byte[]
6.Upload Byte[] by WebService

In Server
7. Save the Byte[] to disk files (my.zip)
8. unzip my.zip to my.xml
9. delete my.zip
10. Reade my.xml to a DataSet
11 Bulk copy Dataset to DataBase Server.

It is to tedious.
I want to change to
In Clinet
1. DataSet1.WriteX ml(Stream myStream)
2. zip myStream.
3. Write myStream to Byte[]
4. Upload Byte[] by WebService

In Server
5 Write Byte[] to Stream
6. unzip Stream
7. read the stream into a DataSet
8 Bulk copy to Database Server.
But the problem is :
How to zip/unzip Stream?
or How to zip/unzip Byte[]?

How can I do that?


Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
26737
by: andrewcw | last post by:
OK I am half way there - I can manipulate the stream without the byte issue like this - but is this the way to push the new values back into the stream & write out the stream without resorting to byte conversion ?? FileStream stream = null; stream = File.Open(fiPath, FileMode.Open, FileAccess.ReadWrite,FileShare.None); System.IO.StreamReader Tin = new System.IO.StreamReader (stream);
5
2547
by: andrewcw | last post by:
I have an object to serialize. TextWriter writer = new StreamWriter("test.xml"); serializer.Serialize(writer,obj); writer.Close(); but below does not, why ?? I have a file that I will have exclusively opened & I use the stream for that operation. THANKS { I am tring to push the object back into the stream )
3
15298
by: MJB | last post by:
I'm getting an IStream back from function xmlHttp.responsestream. I would like to convert this to a System.IO.Stream in order to work with it in my application. Has anyone encountered this and written a conversion? TIA, Matt
4
26796
by: TT (Tom Tempelaere) | last post by:
Hey there, I need a string stream, but I can't find one in .NET. I thought StringWriter would derive from Stream, alas it doesn't do so. Which leads me to my next question: What is the purpose of System.IO.StringWriter (or, what is its added value)??? It can do the same things with StringBuilder, and I see no added value. The reason why I need the string stream, is that I have a library that knows
4
2314
by: fastback66 | last post by:
Evidently per the C++ standard, it is not possible to measure the distance between two stream iterators, because two non-end-of-stream iterators are equal when they are constructed from the same stream. I still don't quite understand why that fact is true. But... I wish to find the first occurance of some sequence in an existing stream. For the moment this stream is a file on disk, but later may be a stream from another process. Anyway,...
8
10439
by: Marc Gravell | last post by:
I want to write a method that will accept a stream as a parameter, and which will write xml to the stream (based in reality on database results) using the XmlTextWriter class. However, this insists on closing my stream, and I can't convince it not to. A much-simplified example is below; basically, as soon as the writer is disposed (marked **** below) the base stream gets closed - which is a pain if I was still using it ;-p The base...
4
2028
by: Helge Jensen | last post by:
In C# 2.0 System.IO.Stream is declared as: public class Stream: ..., IDisposable { ... public void Dispose(); public void Dispose(bool); IDisposable.Dispose(); } Which must be a design-blunder, if not a 100-year sleep. It prevents
0
3110
by: mario.lat_ | last post by:
Hallo to all, I have write a little script for connecting to cisco router BUT I have a problem: I have to send to router all the commands and then I have to read the output. If I send a command1 and read the output for command1 the script works well, If I sent command1 , I send command2 and then I read output for command1 and command2 it works well. If i send command1 and then I read the output for command1 then send command2 I can't...
3
3027
by: sven.suursoho | last post by:
Hello, In main(), the first output API is what I try to achieve. Unfortunately it fails, printing first string as pointer instead of human readable message. Tried to initialize str(""), set new buffer etc, but nothing worked. Ideas? Also might use another internal construct, only API is needed and requirement to reuse existing std::ostream inserters.
4
2328
by: Scott F. Brown | last post by:
Greetings all... I was playing around with compressing streams and came across a behavior that I do not understand. I create a stream (input) from the contents of a textbox. That stream is compressed into another stream (output). I then copy the stream (output) to another stream (input2). The compressed stream (input2) is then decompressed into a final stream (output2). My question is this. I create input2 from output.GetBuffer()...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8869
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7386
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4368
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2771
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1775
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.