From: | Thomas Kellerer <spam_eater(at)gmx(dot)net> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: BLOB help - yes I've read around! |
Date: | 2009-04-08 06:38:46 |
Message-ID: | grhgpj$vqr$1@ger.gmane.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
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
From | Date | Subject | |
---|---|---|---|
Next Message | John Lister | 2009-04-08 07:33:44 | Re: Array passing |
Previous Message | Kris Jurka | 2009-04-08 02:16:46 | Re: Array passing |