Subject | Re: Resettable FBBlobInputStream? |
---|---|
Author | Roman Rokytskyy |
Post date | 2003-09-29T00:07:45Z |
> It isn't possible to seek back?You have to check this. This seems to be more correct way of doing things.
> If not, maybe I could just make anYes, it will. But I see no reason to wrap FBBlobInputStream. I would
> input stream that wraps the current FBBlobInputStream stream (or
> just the blob). If a mark/reset is made, I can just open a new blob
> and discard the old handle. Do you think that would work?
add reset() method as:
public void reset() throws IOException {
close();
openHandle();
}
where openHandle() is the code from constructor:
private void openHandle() throws IOException {
closed = false;
if (isNew) {
throw new SQLException("You can't read a new blob");
}
Object syncObject = getSynchronizationObject();
synchronized(syncObject) {
try {
blob = c.openBlobHandle(blob_id, SEGMENTED);
} catch (GDSException ge) {
throw new FBSQLException(ge);
}
}
}
Also you can add position tracking and do seek(...) after openHandle().
And be sure to add mark()/reset() to FirebirdBlob.BlobInputStream
interface.
Roman