s.size());
if (id.isDataSegmentId()) {
ids.addAll(s.getReferencedIds());
}
try {
s.writeTo(bout);
writeSegment(id, bout.toByteArray(), 0, s.size());
} catch (IOException e) {
throw new IllegalStateException(
"Unable to write remote segment " + id, e);
}