pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: BLOB help - yes I've read around!
Date: Wed, 08 Apr 2009 08:38:46 +0200
Message-ID: <grhgpj$vqr$1@ger.gmane.org> (raw)
In-Reply-To: <49DBCBC2.6080402@yahoo.co.uk>
References: <49DB559F.3030805@yahoo.co.uk>
	<200904071657.08065.achill@matrix.gatewaynet.com>
	<49DB5D63.5040103@yahoo.co.uk>
	<grfoia$t7m$1@ger.gmane.org>
	<49DBC6DC.5030609@yahoo.co.uk>
	<grgham$q84$1@ger.gmane.org>
	<49DBCBC2.6080402@yahoo.co.uk>

Brad Milne, 07.04.2009 23:55:
>> Do not use availabe()
>>
>> This will *not* give you the number of bytes that are "available" in 
>> the stream.
>>
>> Read the Javadocs carefully: it will give you the number of bytes that 
>> can be /read without blocking/
>>
>> Most of the time this will not be the length of the stream.
>>
> Good point Thomas, I hear you. I shouldn't have written that hear as 
> others could follow that. In my implementation it is ok as the stream is 
> complete prior to persisting it. I have an AudioInputStream object, but 
> it is always complete. If you think I should be therefore using a 
> different method/db object then I'd be pleased to hear.

I have never used AudioInputStream. If that one reports the real size when calling available() then it would be the first InputStream that I have seen that does that ;)

If you do use available() you should verify that the size of your BLOB (bytea) in the database is really what you expected. You have to test with sizes that exceed any potential buffer that takes place in the input stream, and I would inspect the source code for available(). 

Thomas




view thread (10+ messages)

Message-ID: <grhgpj$vqr$1@ger.gmane.org>
Permalink:  ../grhgpj$vqr$1@ger.gmane.org/
Also on:    postgresql.org/message-id/grhgpj$vqr$1@ger.gmane.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: spam_eater@gmx.net
  Subject: Re: BLOB help - yes I've read around!
  In-Reply-To: <grhgpj$vqr$1@ger.gmane.org>
  References: <49DB559F.3030805@yahoo.co.uk> <200904071657.08065.achill@matrix.gatewaynet.com> <49DB5D63.5040103@yahoo.co.uk> <grfoia$t7m$1@ger.gmane.org> <49DBC6DC.5030609@yahoo.co.uk> <grgham$q84$1@ger.gmane.org> <49DBCBC2.6080402@yahoo.co.uk> <grhgpj$vqr$1@ger.gmane.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox