Re: binary data

From: "Uwe Kubosch" <donv(at)crusaders(dot)no>
To: "Anders Hermansen" <anders(at)yoyo(dot)no>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: binary data
Date: 2003-03-02 15:34:59
Message-ID: CHECLDNPGHELOIINBBLEKEEKEIAA.donv@crusaders.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

> Can you try the following? Maybe the result slipped through the driver
> without being decoded?
>
> // I think this will work because the is is a ByteArrayInputStream
> byte[] buffer = new byte[is.available()];
> is.read(buffer);
>
> byte[] buffer2 = org.postgresql.util.PGbytea.toBytes(buffer);
>
> response.getOutputStream().write(buffer2, 0, buffer2.length);
> response.getOutputStream().flush();
> is.close();

OK, tried it. buffer is 5527 bytes. The PGbytea.toBytes(buffer) call
returned an array of size 5485. Original file size was 4342 bytes.

Uwe

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Achilleus Mantzios 2003-03-02 16:06:40 Mac OSX
Previous Message Anders Hermansen 2003-03-02 15:17:26 Re: binary data