};
InputStream is = isf.getInputStream();
OutputStream fsos = store.createOutputStream();
length = ObjectConverterUtil.write(fsos, is, bytes, -1);
} catch (IOException e) {
throw new TeiidComponentException(e);
}
// re-construct the new lobs based on the file store
final long lobOffset = offset;
final int lobLength = length;
InputStreamFactory isf = new InputStreamFactory() {
@Override
public InputStream getInputStream() throws IOException {
return store.createInputStream(lobOffset, lobLength);
}
@Override
public boolean isPersistent() {
return true;
}
};
try {
if (lob instanceof BlobType) {
persistedLob = new BlobType(new BlobImpl(isf));
}
else if (lob instanceof ClobType) {
persistedLob = new ClobType(new ClobImpl(isf, ((ClobType)lob).length()));
}
else {
persistedLob = new XMLType(new SQLXMLImpl(isf));
((XMLType)persistedLob).setEncoding(((XMLType)lob).getEncoding());
((XMLType)persistedLob).setType(((XMLType)lob).getType());
}
} catch (SQLException e) {
throw new TeiidComponentException(e);
}
return persistedLob;
}