public void write(DataOut out) { out.begin("map_list"); out.uint("size", items.size()); for (SectionItem<?> t : items) { writeMapItem(out, t.sectionType.code, t.items.size(), t.offset); } out.end(); items.clear(); }
public void write(DataOut out) { out.begin("Section:" + sectionType); List<T> items = this.items; if (sectionType == SectionType.TYPE_STRING_DATA_ITEM) { Buffer buff = new Buffer(); for (int i = 0; i < items.size(); i++) { T t = items.get(i); items.set(i, null); addPadding(out, sectionType.alignment); if (out.offset() != t.offset) { throw new RuntimeException(); } StringDataItem stringDataItem = (StringDataItem) t; stringDataItem.write(out, buff); buff.reset(); } } else { for (int i = 0; i < items.size(); i++) { T t = items.get(i); items.set(i, null); addPadding(out, sectionType.alignment); if (out.offset() != t.offset) { System.err.println("Error for type:" + this.sectionType + ", " + t.index); throw new RuntimeException(); } t.write(out); } } out.end(); }
public void writeMapItem(DataOut out, int type, int size, int offset) { out.begin("map_item"); out.ushort("type", type); out.ushort("unused", 0); out.uint("size", size); out.uint("offset", offset); out.end(); }
public void write(DataOut out) { out.begin("map_list"); out.uint("size", items.size()); for (SectionItem<?> t : items) { writeMapItem(out, t.sectionType.code, t.items.size(), t.offset); } out.end(); items.clear(); }
public void write(DataOut out) { out.begin("Section:" + sectionType); List<T> items = this.items; if (sectionType == SectionType.TYPE_STRING_DATA_ITEM) { Buffer buff = new Buffer(); for (int i = 0; i < items.size(); i++) { T t = items.get(i); items.set(i, null); addPadding(out, sectionType.alignment); if (out.offset() != t.offset) { throw new RuntimeException(); } StringDataItem stringDataItem = (StringDataItem) t; stringDataItem.write(out, buff); buff.reset(); } } else { for (int i = 0; i < items.size(); i++) { T t = items.get(i); items.set(i, null); addPadding(out, sectionType.alignment); if (out.offset() != t.offset) { System.err.println("Error for type:" + this.sectionType + ", " + t.index); throw new RuntimeException(); } t.write(out); } } out.end(); }
public void writeMapItem(DataOut out, int type, int size, int offset) { out.begin("map_item"); out.ushort("type", type); out.ushort("unused", 0); out.uint("size", size); out.uint("offset", offset); out.end(); }