Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Using of java.util.zip.GZIPOutputStream

Subject: Using of java.util.zip.GZIPOutputStream

From: David

Date: 3 Mar, 2009 17:35:03

Message: 1 of 4

Hi,

I try to compress an array of bytes using java.util.zip.GZIPOutputStream. The important thing is that it should not written into a file, but the output should be an array of bytes too.

I try that :

toConvert = 'Hello';
in = unicode2native(toConvert);

out = java.io.ByteArrayOutputStream;
gzipOutStream = java.util.zip.GZIPOutputStream(out);
gzipOutStream.write(in);
gzipOutStream.flush();
output = out.toByteArray();

gzipOutStream.close();

but it seems that the method .write for the object gzipOutStrem don't work.

in gzip.m of matlab they use :
streamCopier = ... com.mathworks.mlwidgets.io.InterruptibleStreamCopier.getInterruptibleStreamCopier;

in order to write into the GZIPOutputStream, but it seems to work only with files.

My goal is to have something like a box which compress into gzip/deflate format an array of bytes, and outputs the compressed array of bytes.

Thanks for your help
David

Subject: Using of java.util.zip.GZIPOutputStream

From: Ed Yu

Date: 20 Mar, 2009 19:15:20

Message: 2 of 4

"David " <ddieffen@gmail.com> wrote in message <gojpo7$cva$1@fred.mathworks.com>...
> Hi,
>
>...
> My goal is to have something like a box which compress into gzip/deflate format an array of bytes, and outputs the compressed array of bytes.
>
> Thanks for your help
> David

Have you looked at java.io.ByteArray[Input|Output]Stream?

Subject: Using of java.util.zip.GZIPOutputStream

From: David

Date: 20 Mar, 2009 20:09:02

Message: 3 of 4

"Ed Yu" <ekyu88@hotmail.com> wrote in message <gq0q07$1k1$1@fred.mathworks.com>...
> "David " <ddieffen@gmail.com> wrote in message <gojpo7$cva$1@fred.mathworks.com>...
> > Hi,
> >
> >...
> > My goal is to have something like a box which compress into gzip/deflate format an array of bytes, and outputs the compressed array of bytes.
> >
> > Thanks for your help
> > David
>
> Have you looked at java.io.ByteArray[Input|Output]Stream?



Not yet, thanks for the idea !

David

Subject: Using of java.util.zip.GZIPOutputStream

From: Jesse Hopkins

Date: 22 Oct, 2009 14:07:19

Message: 4 of 4

David -

I'm curious if you got this to work. There were a couple files on the file exchange here that seem to do what you are trying:

http://www.mathworks.com/matlabcentral/fileexchange/8899

I tried running these, and the compression script worked fine (dzip.m), however the deflate script (dunzip.m) was throwing java exceptions (see me comments in the file exchange). I was running these in R2008b. Have you tried these files?

Thanks!
Jesse




"David " <ddieffen@gmail.com> wrote in message <gq0t4t$9i7$1@fred.mathworks.com>...
> "Ed Yu" <ekyu88@hotmail.com> wrote in message <gq0q07$1k1$1@fred.mathworks.com>...
> > "David " <ddieffen@gmail.com> wrote in message <gojpo7$cva$1@fred.mathworks.com>...
> > > Hi,
> > >
> > >...
> > > My goal is to have something like a box which compress into gzip/deflate format an array of bytes, and outputs the compressed array of bytes.
> > >
> > > Thanks for your help
> > > David
> >
> > Have you looked at java.io.ByteArray[Input|Output]Stream?
>
>
>
> Not yet, thanks for the idea !
>
> David

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us