public Section openSection(TableOfContents.Section tocSec) { int position = tocSec.off; 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(position + tocSec.byteCount); return new Section("section", sectionData); }
public Section appendSection(int maxByteCount, String name) { 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; }
/** * <b>IMPORTANT</b> To open a dex section by {@code TableOfContents.Section}, * please use {@code openSection(TableOfContents.Section tocSec)} instead of * passing tocSec.off to this method. * * <b>Because dex section returned by this method never checks * tocSec's bound when reading or writing data.</b> */ public Section openSection(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("temp-section", sectionData); }
/** * <b>IMPORTANT</b> To open a dex section by {@code TableOfContents.Section}, * please use {@code openSection(TableOfContents.Section tocSec)} instead of * passing tocSec.off to this method. * * <b>Because dex section returned by this method never checks * tocSec's bound when reading or writing data.</b> */ public Section openSection(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("temp-section", sectionData); }
public Section openSection(TableOfContents.Section tocSec) { int position = tocSec.off; 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(position + tocSec.byteCount); return new Section("section", sectionData); }
public Section appendSection(int maxByteCount, String name) { 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; }