Re: zlib OpennetCF question



The zlibCE source download from our site has been updated with these fixes.

http://www.opennetcf.com/zlibce


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com




"Sven Rutten" <svenrutten@xxxxxxxxxxx> wrote in message
news:AB060359-AB05-4481-921D-779E77800FDE@xxxxxxxxxxxxxxxx
Thanks Chris, I've found it already, sorry.

But another question to that: I want to transmit the compressed byte.

Now my inputbyte has a length of about 38'000, but I cannot know the
length of the compressed byte.
You are just declaring it in your code, there as 1024. So as I dont know
it, I am using 10'000, as the always produced something between 5'000 and
7'000 compressed.

But my problem is, that I now have a compressed byte with the length of
10'000, and not the "real" size of it, meaning that the last 3-5'000
entries are just empty.

How can I know how long the bytearray really is and redim it?

The same for the uncompressed bytearray after uncompressing. I could
submit the length of the original bytearray with it to dim it correctly,
but yeah that's not really a good solution...

Thanks a lot

Sven

"<ctacke/>" <ctacke[at]opennetcf[dot]com> schrieb im Newsbeitrag
news:eqd$5LiBIHA.748@xxxxxxxxxxxxxxxxxxxxxxx
Directly from the sample that comes with the zlibce download:

private static void TestCompressDecompress()
{
string source = "A quick brown fox jumped over lazy dogs";

byte[] src = Encoding.ASCII.GetBytes(source);
byte[] dst = new byte[1024];
ErrorCode ret = zlibCE.Compress(dst, src);

src = new byte[1024];
ret = zlibCE.Uncompress(src, dst);
}


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Managed Code in an Embedded World
www.OpenNETCF.com


"Sven Rutten" <svenrutten@xxxxxxxxxxx> wrote in message
news:E679C797-FCB0-45E7-B6BF-C7207BC290DD@xxxxxxxxxxxxxxxx
Hello

I'm using this code:

Dim inf As Stream = New System.IO.FileStream("\My
Documents\test.txt", FileMode.Open)
Dim outf As Stream = File.Create("\My Documents\test.zip")
zlibCE.Deflate(inf, outf, 5)
inf.Close()
outf.Close()

That is working. But I have now no file, but a String which I want to
compress. So I tried this:

Dim c As String = "TestingTestingTesting"
Dim tocompress() As Byte =
System.Text.Encoding.Default.GetBytes(c)
Dim inf As Stream = New MemoryStream()
inf.Write(tocompress, 0, tocompress.Length)
Dim outf As Stream = File.Create("\My Documents\test.jj")
zlibCE.Deflate(inf, outf, 5)
inf.Close()
outf.Close()

So I convert to String to a Byte(), then I create a new MemoryStream,
then I write the Byte to to MemoryStream.

After that I am Deflating normally...

But its not working?

What's Wrong?

Thanks

Sven




.



Relevant Pages

  • Re: zlib OpennetCF question
    ... Chris Tacke, Embedded MVP ... Managed Code in an Embedded World ... I could submit the length of the original bytearray with it to dim it correctly, but yeah that's not really a good solution... ... But I have now no file, but a String which I want to compress. ...
    (microsoft.public.pocketpc.developer)
  • Re: What is up with - The Targeted Version of the .net Compact Framework does not support latebo
    ... Chris Tacke, Embedded MVP ... Managed Code in an Embedded World ... Dim cmd As New System.Data.SqlServerCe.SqlCeCommand("Select p_item, ... lvi.SubItems.Add) 'error thrown here ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Invalid cast exception when adding values from SQL CE SERVER table to a lsitview - Why?
    ... Are you getting back any values that can't be converted to a string (maybe ... Chris Tacke, Embedded MVP ... Managed Code in an Embedded World ... Dim cmd As New System.Data.SqlServerCe.SqlCeCommand("Select p_item, ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: gzip compression for compact framework
    ... You'd have to compress on one end and decompress ... Chris Tacke - Embedded MVP ... Managed Code in the Embedded World ... GzIp header and for the GetwebResponse methods i decompress it. ...
    (microsoft.public.windowsce.app.development)
  • Re: today plugin in managed code?
    ... Chris Tacke, Embedded MVP ... Managed Code in an Embedded World ... constraints) and the customer was very happy with the end result. ...
    (microsoft.public.pocketpc.developer)

Loading