void convertHeap(ArrayStructureBB asbb, int pos, StructureMembers sm) throws java.io.IOException, InvalidRangeException { ByteBuffer bb = asbb.getByteBuffer(); for (StructureMembers.Member m : sm.getMembers()) { if (m.getDataType() == DataType.STRING) { m.setDataObject(ByteOrder.nativeOrder()); // the index is always written in "native order" int size = m.getSize(); int destPos = pos + m.getDataParam(); String[] result = new String[size]; for (int i = 0; i < size; i++) result[i] = headerParser.readHeapString(bb, destPos + i * 16); // 16 byte "heap ids" are in the ByteBuffer int index = asbb.addObjectToHeap(result); bb.order(ByteOrder.nativeOrder()); // the string index is always written in "native order" bb.putInt(destPos, index); // overwrite with the index into the StringHeap } else if (m.isVariableLength()) { int destPos = pos + m.getDataParam(); bb.order(ByteOrder.LITTLE_ENDIAN); ByteOrder bo = (ByteOrder) m.getDataObject(); int endian = bo.equals(ByteOrder.LITTLE_ENDIAN) ? RandomAccessFile.LITTLE_ENDIAN : RandomAccessFile.BIG_ENDIAN; Array vlenArray = headerParser.readHeapVlen(bb, destPos, m.getDataType(), endian); int index = asbb.addObjectToHeap(vlenArray); bb.order(ByteOrder.nativeOrder()); // the string index is always written in "native order" bb.putInt(destPos, index); // overwrite with the index into the StringHeap } } }
public String[] readFilteredStringData(LayoutBB layout) throws java.io.IOException { int size = (int) layout.getTotalNelems(); String[] sa = new String[size]; while (layout.hasNext()) { LayoutBB.Chunk chunk = layout.next(); ByteBuffer bb = chunk.getByteBuffer(); //bb.position(chunk.getSrcElem()); if (debugHeapStrings) System.out.printf("readFilteredStringData chunk=%s%n", chunk); int destPos = (int) chunk.getDestElem(); for (int i = 0; i < chunk.getNelems(); i++) { // 16 byte "heap ids" sa[destPos++] = headerParser.readHeapString(bb, (chunk.getSrcElem() + i) * 16); // LOOK does this handle section correctly ?? } } return sa; }
String[] result = new String[size]; for (int i = 0; i < size; i++) result[i] = headerParser.readHeapString(bb, destPos + i * 16); // 16 byte "heap ids" are in the ByteBuffer
String[] result = new String[size]; for (int i = 0; i < size; i++) result[i] = headerParser.readHeapString(bb, destPos + i * 16); // 16 byte "heap ids" are in the ByteBuffer
if (chunk == null) continue; for (int i = 0; i < chunk.getNelems(); i++) { // 16 byte "heap ids" sa[count++] = headerParser.readHeapString(chunk.getSrcPos() + layout.getElemSize() * i);
if (chunk == null) continue; for (int i = 0; i < chunk.getNelems(); i++) { // 16 byte "heap ids" sa[count++] = headerParser.readHeapString(chunk.getSrcPos() + layout.getElemSize() * i);
if (chunk == null) continue; for (int i = 0; i < chunk.getNelems(); i++) { // 16 byte "heap ids" sa[count++] = headerParser.readHeapString(chunk.getSrcPos() + layout.getElemSize() * i);
for (int i = 0; i < chunk.getNelems(); i++) { long address = chunk.getSrcPos() + layout.getElemSize() * i; String sval = readHeapString(address); data.set(count++, sval);
for (int i = 0; i < chunk.getNelems(); i++) { long address = chunk.getSrcPos() + layout.getElemSize() * i; String sval = readHeapString(address); data.set(count++, sval);
for (int i = 0; i < chunk.getNelems(); i++) { long address = chunk.getSrcPos() + layout.getElemSize() * i; String sval = readHeapString(address); data.set(count++, sval);