Hi
I am sorry to post it here, its not the correct forum to post generic Java
related problems
pls suggest me another list, JDC has "Submit a Bug" option but not "Post a
Generic Query" one.
which is a better place to post such a query
anyway for now i will state the problem
i am writing a simple class which takes a String as a parameter and writes
to a ByteArrayOutputStream
in compressed form using GZIPOutputStream, and later on converts the
ByteArray to a compressedString
there is another class which takes the compressedString as a parameter and
deflates the string to
the original one using ByteArrayInputStream as the parameter for the
GZIPInputStream's constructor
the problem is
this program works for certain strings and crashes for others
I get different errors like
1 EOFException
2 GZIP trailer is corrupt
3 ZIPException -invalid bit length repeat
the GZIPInputStream works fine if the parameter to its constructor is a
ServletInputStream
[ acquired by request.getInputStream() in the recievibg servlet or even
for a FileInputStream]
it appears to me that somehow the InputStream acquired by the following
snippet gets corrupted
and is no more a Valid GZIP Format stream.
[
InputStream inp = new ByteArrayInputStream
( compressedString.getBytes( ) );
GZIPInputStream in = new GZIPInputStream(inp);
]
Here are a few Sample Strings for which it works and others for which it
doesnt
----------------------------------------------------------------------------
---------------------------------------
//////////////////////////////////////////////////////////////////
// Following sample Strings DONT WORK
//////////////////////////////////////////////////////////////////
string =
"<OFX><SONRS><STATUS><CODE>s</CODE></STATUS></SONRS></OFX>";
string =
"<OFX><SONRS><STATUS><CODE>abc</CODE></STATUS></SONRS></OFX>";
string = "<OFX><SONRS><a><CODE>abc</CODE></a></SONRS></OFX>";
string = "<OFX><SONRS><AB><CODE>abc</CODE></AB></SONRS></OFX>";
string = "<OFX><SONRS><CODE><xy>abc</xy></CODE></SONRS></OFX>";
//////////////////////////////////////////////////////////////////
// FOllOWING WORKS ??????????
//////////////////////////////////////////////////////////////////
string = "<OFX><SONRS><CODE><x>abc</x></CODE></SONRS></OFX>";
string = "<OFX><SONRS><CODE>abc</CODE></SONRS></OFX>";
string = "<a><b>ddd</b></a>";
string = "<OFX><SONRS>abc</SONRS></OFX>";
Thanks in anticipation
and sorry for the trobule to others
regards
Vikram Verma
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html