while (off < data.length) {
try {
int len = in.read(data, off, data.length - off);
if (len < 0) {
String msg = "Unexpected end of record after " + off + " bytes.";
throw new JournalException(msg);
}
off += len;
} catch (IOException e) {
String msg = "I/O error after " + off + " bytes.";
throw new JournalException(msg, e);
}
}
try {
Thread.sleep(writeDelay);
} catch (InterruptedException e) {
throw new JournalException("Interrupted in append().");
}
records.add(new MemoryRecord(getId(), record.getProducerId(), data));
record.setRevision(records.size());
}