int rightWidth = getAnnotationWidth();
int leftWidth = outputWidth - rightWidth - 1;
String padding = Strings.repeat(" ", 1000);
TwoColumnOutput twoc = new TwoColumnOutput(out, leftWidth, rightWidth, "|");
Integer[] keys = new Integer[annotatations.size()];
keys = annotatations.keySet().toArray(keys);
AnnotationEndpoint[] values = new AnnotationEndpoint[annotatations.size()];
values = annotatations.values().toArray(values);
for (int i=0; i<keys.length-1; i++) {
int rangeStart = keys[i];
int rangeEnd = keys[i+1];
AnnotationEndpoint annotations = values[i];
for (AnnotationItem pointAnnotation: annotations.pointAnnotations) {
String paddingSub = padding.substring(0, pointAnnotation.indentLevel*2);
twoc.write("", paddingSub + pointAnnotation.annotation);
}
String right;
AnnotationItem rangeAnnotation = annotations.rangeAnnotation;
if (rangeAnnotation != null) {
right = padding.substring(0, rangeAnnotation.indentLevel*2);
right += rangeAnnotation.annotation;
} else {
right = "";
}
String left = Hex.dump(data, rangeStart, rangeEnd - rangeStart, rangeStart, hexCols, 6);
twoc.write(left, right);
}
int lastKey = keys[keys.length-1];
if (lastKey < data.length) {
String left = Hex.dump(data, lastKey, data.length - lastKey, lastKey, hexCols, 6);
twoc.write(left, "");
}
}