Through Teiid there will be an extra layer of marshaling, depending upon size of the blob this can be a factor. But it is hard to compare that simply, one would have peel each layer make side by side comparisons. There can be others like were connections hot or not, how is your java program reading blob data.
Java is reading the data from the file, writes into a PipedOutputStream, which is than consumed in another thread
Can you please explain what kind of marshaling, is it a way teiid packages a blob data to stream?
That is incorrect comparison with your Java program then IMO. In Java program, you are working everything under single VM, with Teiid you have at least 2 VMs, one Teiid and client. Depending upon how Blob is read that is another process it is being read from. When you mentioned you are using the JNDI name, I assumed you are reading from an external database, which I still think is the case for Teiid, not so for the Java program. From your above comment, I read as in your Java program there is no JNDI lookup etc, just reading from the file and using the piped in/out and makes the result in a separate thread.
java : read from file/write to pipe/read
java external client -> Teiid --> look up JNDI/connection/read (unmarshall) data/write to inputstream -> marshell result to external client --> data read in external client
also note database vendors might send data in some specific format or condensed etc that may be reversed in jdbc driver, to compare you need to write a program that you can read directly from the source using same fetching techniques you used in the Inputstreamfactory and carefully account for connection times etc, and then read that data from a second program not in from separate thread.
Otherwise, you can also use Teiid Embedded wherein single vm you can have your client reading and Teiid reading in same vm to bring them little closer in comparison.