File fullPath = getTicksFile();
FileOutputStream fos = null;
try {
fos = new FileOutputStream(fullPath, true);
BufferedOutputStream bos = new BufferedOutputStream(fos, 4096);
FudgeMsgWriter fmsw = getFudgeContext().createMessageWriter(bos);
for (FudgeMsg tick : ticks) {
if (BloombergTickReplayUtils.isTerminateMsg(tick)) {
terminateMsg = tick;
continue;
}
_nBlocks += FudgeSize.calculateMessageSize(tick);
String securityDes = tick.getString(SECURITY_KEY);
String buid = getBloombergBUID(securityDes);
((MutableFudgeMsg) tick).add(BUID_KEY, buid);
fmsw.writeMessage(tick, 0);
fmsw.flush();
}
_nWrites++;
} catch (FileNotFoundException e) {
s_logger.warn("cannot open file {} for writing", fullPath);
throw new OpenGammaRuntimeException("Cannot open file " + fullPath + " for writing", e);