Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 46205632BB6 for ; Wed, 8 Apr 2009 03:39:02 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 48307-02 for ; Wed, 8 Apr 2009 03:39:00 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mail.postgresql.org (Postfix) with ESMTP id E5128632348 for ; Wed, 8 Apr 2009 03:39:00 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LrRQz-00076X-Tj for pgsql-jdbc@postgresql.org; Wed, 08 Apr 2009 06:38:53 +0000 Received: from 217.110.94.67 ([217.110.94.67]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Apr 2009 06:38:53 +0000 Received: from spam_eater by 217.110.94.67 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Apr 2009 06:38:53 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: Re: BLOB help - yes I've read around! Date: Wed, 08 Apr 2009 08:38:46 +0200 Lines: 22 Message-ID: References: <49DB559F.3030805@yahoo.co.uk> <200904071657.08065.achill@matrix.gatewaynet.com> <49DB5D63.5040103@yahoo.co.uk> <49DBC6DC.5030609@yahoo.co.uk> <49DBCBC2.6080402@yahoo.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 217.110.94.67 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666 In-Reply-To: <49DBCBC2.6080402@yahoo.co.uk> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.599 tagged_above=0 required=5 tests=RCVD_IN_DNSWL_LOW=-1, RCVD_NUMERIC_HELO=2.599 X-Spam-Level: * X-Archive-Number: 200904/29 X-Sequence-Number: 19476 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