public Section open(int position) { if (position < 0 || position >= data.capacity()) { throw new IllegalArgumentException("position=" + position + " length=" + data.capacity()); } ByteBuffer sectionData = data.duplicate(); sectionData.order(ByteOrder.LITTLE_ENDIAN); // necessary? sectionData.position(position); sectionData.limit(data.capacity()); return new Section("section", sectionData); }
public Section open(int position) { if (position < 0 || position >= data.capacity()) { throw new IllegalArgumentException("position=" + position + " length=" + data.capacity()); } ByteBuffer sectionData = data.duplicate(); sectionData.order(ByteOrder.LITTLE_ENDIAN); // necessary? sectionData.position(position); sectionData.limit(data.capacity()); return new Section("section", sectionData); }
public Section open(int position) { if (position < 0 || position >= data.capacity()) { throw new IllegalArgumentException("position=" + position + " length=" + data.capacity()); } ByteBuffer sectionData = data.duplicate(); sectionData.order(ByteOrder.LITTLE_ENDIAN); // necessary? sectionData.position(position); sectionData.limit(data.capacity()); return new Section("section", sectionData); }
public Section appendSection(int maxByteCount, String name) { if ((maxByteCount & 3) != 0) { throw new IllegalStateException("Not four byte aligned!"); } int limit = nextSectionStart + maxByteCount; ByteBuffer sectionData = data.duplicate(); sectionData.order(ByteOrder.LITTLE_ENDIAN); // necessary? sectionData.position(nextSectionStart); sectionData.limit(limit); Section result = new Section(name, sectionData); nextSectionStart = limit; return result; }
public Section appendSection(int maxByteCount, String name) { if ((maxByteCount & 3) != 0) { throw new IllegalStateException("Not four byte aligned!"); } int limit = nextSectionStart + maxByteCount; ByteBuffer sectionData = data.duplicate(); sectionData.order(ByteOrder.LITTLE_ENDIAN); // necessary? sectionData.position(nextSectionStart); sectionData.limit(limit); Section result = new Section(name, sectionData); nextSectionStart = limit; return result; }