2 Bronze

Exception using BlobWritePartial and FpFileInputStream

This discussion thread has been imported from the Centera Developer Portal Forums.

The first message is shown here, and the complete thread is in the attached PDF file.

Please read the PDF and continue the discussion here.

From stefano.valsecchi@txt.it

Posted: Wed Mar 05, 2008

Good morning,

We are implementing a routine whose target is to archive a single, large file in Centera storage and we have found some problem with blob slicing technique:

Here is a portion of our code (variable are replaced with values for clarity):

//Open the second slice of a file. Slice size is 100.000 bytes. File size is 9 Mbyte
FPFileInputStream fis = new FPFileInputStream(new File(“c:/test.mpeg”), 100000, 100000);

// Slice writing
myclip.BlobWritePartial(fis, FP_OPTION_SERVER_CALCID_STREAMING, 2);

If slice size is greater than internal buffer size (16K), the result is an FPLibraryException wrapping the following IndexOutOfBoundException

at java.io.RandomAccessFile.readBytes(Native Method)
at java.io.RandomAccessFile.read(RandomAccessFile.java:307)
at com.filepool.fplibrary.FPFileInputStream.read(Unknown Source)
at it.txt.polymedia.feeds.actions.video.CenteraArchiver$MonitoredFileInputStream.read(CenteraArchiver.java:845)
at com.filepool.natives.FPLibraryNative.FPTag_BlobWritePartial(Native Method)
at com.filepool.fplibrary.FPTag.BlobWritePartial(Unknown Source)

Inserting a breakpoint in method read of class RandomAccessFile, we noted a call with the following parameters:

RandomAccessFile.read(buffer, 100000, 16384);

Where buffer is a byte array of 16384 elements (the internal buffer, I suppose)
Our suspect is that FPFileInputStream class store the offset received in the constructor and passes it to read method (Other test with different offset values confirm this suspect).
The problem is that the offset parameter of read method refer to the buffer and not to the file!!!

Is it a bug of FPFileInputStream class or there is something wrong in our code? Can somebody help?



P.S.: I have found another topic on this forum for the same problem with title blobwritepartial problem and last post date 16/03/2007, but it doesn't solved.

0 Kudos