Subject Re: [Firebird-Java] Re: BLOB SUB_TYPE 1
Author Roman Rokytskyy
> Yeah, that is what I was using, but I was trying to workaround some
> performance inconsistencies in those methods (including
> #setString()).

Ok, then you can add that method to the JayBird 1.5.4 sources and be sure
that this will appear in JayBird 1.5.5 (just do not forget to fill a
bug/feature report).

> In the current code, the calle to #setBytes will create a
> ByteArrayInputStream around "blobBytes", which calls
> FBBlob#copyStream. This method then creates a new byte array of size
> bufferlength which is often 16*1024 bytes in length. This buffer is
> created even if you are only writing a few bytes. Then this method
> calls FBBlobOutputStream#write, which creates yet another 16*1024
> sized buffer. And it gets worse. If the bytes sent to
> FBBlobOutputStream#write is less than "bufferlength", then TWO
> buffers are created. One of 16*1024 that is NEVER even used, and
> another that is the same size as the input bytes, which the input
> bytes are then copied into before finally being sent to the database
> server.
>
> This happens for every call to #setBytes, #setString,
> #setBinaryStream, etc. So you can see why (at least for the current
> version of the driver), I was trying to avoid those calls.

As we have already discussed that privately, I will be happy to commit a
patch you provide to this part. Unfortunatelly I'm at present busy with my
daytime job and cannot promise you to take care of it.

Roman