473,383 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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.WriteXml("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.WriteXml(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 12666
ad
Thanks,
But how to use SharpZipLib to zip/unzip Stream?

"Truong Hong Thi" <th*****@gmail.com>
???????:11**********************@g43g2000cwa.googl egroups.com...
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.tcc.edu.tw> wrote in message
news:um**************@TK2MSFTNGP11.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.WriteXml("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.WriteXml(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.tcc.edu.tw> wrote in message
news:ug*************@TK2MSFTNGP09.phx.gbl...
Thanks,
But how to use SharpZipLib to zip/unzip Stream?


There are two classes to do this in the ICSharpCode.SharpZIpLib.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.tcc.edu.tw> wrote in message
news:um**************@TK2MSFTNGP11.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.WriteXml("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.WriteXml(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
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...
5
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...
3
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...
4
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...
4
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...
8
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...
4
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...
0
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...
3
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...
4
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.