[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: RE: [saml-dev] DEFLATE Implementation in JAVA
I've tried the following with different compression levels, but none of it works. import sun.misc.BASE64Encoder; import java.util.zip.Deflater; import java.util.zip.DeflaterOutputStream; import java.io.ByteArrayOutputStream; Deflater deflater = new Deflater(Deflater.DEFLATED, true); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); DeflaterOutputStream deflaterOutputStream = new DeflaterOutputStream(byteArrayOutputStream, deflater); deflaterOutputStream.write(saml_message_string.getBytes()); deflaterOutputStream.close(); String encoded = new BASE64Encoder().encode(byteArrayOutputStream.toByteArray()); --Lars -----Original Message----- From: Ian Young [mailto:ian@iay.org.uk] Sent: Mittwoch, 12. April 2006 15:25 To: Lars Beekmann Cc: saml-dev@lists.oasis-open.org Subject: Re: [saml-dev] DEFLATE Implementation in JAVA Lars Beekmann wrote: > But the code I use to deflate seems correct to me. I would appreciate > any hints, what I might be doing wrong! [...] > ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); > > DeflaterOutputStream deflaterOutputStream = new > DeflaterOutputStream(byteArrayOutputStream); I'm not sure it is relevant, but that DeflaterOutputStream constructor uses a default Deflater with a wrapper round the stream. It is possible that you need one without the wrapper, for which you'd need to create the Deflater yourself (there is a constructor with a "nowrap" parameter) and pass it in to the appropriate DeflaterOutputStream constructor as a second parameter. -- Ian --------------------------------------------------------------------- This publicly archived list supports open discussion on implementing the SAML OASIS Standard. To minimize spam in the archives, you must subscribe before posting. [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/ Alternately, using email: list-[un]subscribe@lists.oasis-open.org List archives: http://lists.oasis-open.org/archives/saml-dev/ Committee homepage: http://www.oasis-open.org/committees/security/ List Guidelines: http://www.oasis-open.org/maillists/guidelines.php Join OASIS: http://www.oasis-open.org/join/
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]