Обсуждение: truncated InputStream returned with getAsciiInputStream()

Поиск
Список
Период
Сортировка

truncated InputStream returned with getAsciiInputStream()

От
Isabelle Therrien
Дата:
Hi

I've seen a couple of discussion about this subject, and I wonder if you
could help me finding a workaround for my problem too.

I work with big XML documents, around 12000 to 15000 characters.  Since
these documents were occasionnally causing me performance problems
during store operations, I tried using java.util.zip package's "deflate"
and "inflate" methods to compress my data.  These method output byte
arrays, and the bytes can have any arbitrary value.  Including "-1".

So now, to store my data in the database, I use BLOB instead of TEXT.
It works fine, my data is stored and retreived without any problem with
method set and getAsciiStream()... until there is a byte with value "-1"
in my Stream.  If the 43rd byte is "-1", the stream has a length of 42.

The problem is that I cannot really escape the character, since it's
compressed data, and I can't just remove it assuming it's a null
character, cause it's not.

Somebody has a clue?

Isabelle


Re: truncated InputStream returned with getAsciiInputStream()

От
Rene Pijlman
Дата:
On Thu, 30 Aug 2001 18:24:30 -0400, you wrote:
>So now, to store my data in the database, I use BLOB instead of TEXT.
>It works fine, my data is stored and retreived without any problem with
>method set and getAsciiStream()... until there is a byte with value "-1"
>in my Stream.  If the 43rd byte is "-1", the stream has a length of 42.

Can you post a small program that reproduces the problem?

Regards,
René Pijlman <rene@lab.applinet.nl>

Re: truncated InputStream returned with getAsciiInputStream()

От
Barry Lind
Дата:
Is there a reason you are not using getBinaryStream()?  You can't read a
binary file with and AsciiStream.

thanks,
--Barry

Isabelle Therrien wrote:
> Hi
>
> I've seen a couple of discussion about this subject, and I wonder if you
> could help me finding a workaround for my problem too.
>
> I work with big XML documents, around 12000 to 15000 characters.  Since
> these documents were occasionnally causing me performance problems
> during store operations, I tried using java.util.zip package's "deflate"
> and "inflate" methods to compress my data.  These method output byte
> arrays, and the bytes can have any arbitrary value.  Including "-1".
>
> So now, to store my data in the database, I use BLOB instead of TEXT.
> It works fine, my data is stored and retreived without any problem with
> method set and getAsciiStream()... until there is a byte with value "-1"
> in my Stream.  If the 43rd byte is "-1", the stream has a length of 42.
>
> The problem is that I cannot really escape the character, since it's
> compressed data, and I can't just remove it assuming it's a null
> character, cause it's not.
>
> Somebody has a clue?
>
> Isabelle
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>
>