The usage of the method DataValueDescriptor.setValue(InputStream stream, int length) is unclear. The intended use seems to be to pass on the known length of an input stream set from the JDBC-layer (i.e. setBinaryStream).
There seems to be two distinct cases:
- the logical length of the stream is known
- the logical length of the stream is not known
Using -1 when the length is not known seems to be an established pattern.