public static DataRelationElementV11 fromDebugSegment(byte[] segment, int currentPos, int textAreaOffset, ByteOrder order) { int flags = ByteBuffer.wrap(segment, currentPos + 2, Short.BYTES).order(order).getShort(); int parentBufferNameOffset = ByteBuffer.wrap(segment, currentPos + 8, Integer.BYTES).order(order).getInt(); String parentBufferName = parentBufferNameOffset == 0 ? "" : RCodeInfo.readNullTerminatedString(segment, textAreaOffset + parentBufferNameOffset); int childBufferNameOffset = ByteBuffer.wrap(segment, currentPos + 12, Integer.BYTES).order(order).getInt(); String childBufferName = childBufferNameOffset == 0 ? "" : RCodeInfo.readNullTerminatedString(segment, textAreaOffset + childBufferNameOffset); int nameOffset = ByteBuffer.wrap(segment, currentPos + 16, Integer.BYTES).order(order).getInt(); String name = nameOffset == 0 ? "" : RCodeInfo.readNullTerminatedString(segment, textAreaOffset + nameOffset); int fieldPairsOffset = ByteBuffer.wrap(segment, currentPos + 20, Integer.BYTES).order(order).getInt(); String fieldPairs = fieldPairsOffset == 0 ? "" : RCodeInfo.readNullTerminatedString(segment, textAreaOffset + fieldPairsOffset); return new DataRelationElementV11(name, parentBufferName, childBufferName, fieldPairs, flags); }
public static IDatasetElement fromDebugSegment(String name, Set<AccessType> accessType, byte[] segment, int currentPos, int textAreaOffset, ByteOrder order) { int bufferCount = ByteBuffer.wrap(segment, currentPos, Short.BYTES).order(order).getShort(); int relationshipCount = ByteBuffer.wrap(segment, currentPos + 2, Short.BYTES).order(order).getShort(); int nameOffset = ByteBuffer.wrap(segment, currentPos + 16, Integer.BYTES).order(order).getInt(); String name2 = nameOffset == 0 ? name : RCodeInfo.readNullTerminatedString(segment, textAreaOffset + nameOffset); String[] bufferNames = new String[bufferCount]; for (int zz = 0; zz < bufferCount; zz++) { bufferNames[zz] = RCodeInfo.readNullTerminatedString(segment, textAreaOffset + ByteBuffer.wrap(segment, currentPos + 24 + (zz * 4), Integer.BYTES).order(order).getInt()); } int currPos = currentPos + 4 * bufferCount; IDataRelationElement[] relations = new DataRelationElementV11[relationshipCount]; for (int zz = 0; zz < relationshipCount; zz++) { IDataRelationElement param = DataRelationElementV11.fromDebugSegment(segment, currPos, textAreaOffset, order); currPos += param.getSizeInRCode(); relations[zz] = param; } return new DatasetElementV11(name2, accessType, bufferNames, relations); }
public static IDatasetElement fromDebugSegment(String name, Set<AccessType> accessType, byte[] segment, int currentPos, int textAreaOffset, ByteOrder order) { int bufferCount = ByteBuffer.wrap(segment, currentPos, Short.BYTES).order(order).getShort(); int relationshipCount = ByteBuffer.wrap(segment, currentPos + 2, Short.BYTES).order(order).getShort(); int nameOffset = ByteBuffer.wrap(segment, currentPos + 16, Integer.BYTES).order(order).getInt(); String name2 = nameOffset == 0 ? name : RCodeInfo.readNullTerminatedString(segment, textAreaOffset + nameOffset); String[] bufferNames = new String[bufferCount]; for (int zz = 0; zz < bufferCount; zz++) { bufferNames[zz] = RCodeInfo.readNullTerminatedString(segment, textAreaOffset + ByteBuffer.wrap(segment, currentPos + 24 + (zz * 4), Integer.BYTES).order(order).getInt()); } // Round to next byte int currPos = currentPos + 24 + (bufferCount * 4 + 7 & -8); IDataRelationElement[] relations = new DataRelationElementV11[relationshipCount]; for (int zz = 0; zz < relationshipCount; zz++) { IDataRelationElement param = DataRelationElementV11.fromDebugSegment(segment, currPos, textAreaOffset, order); currPos += param.getSizeInRCode(); relations[zz] = param; } return new DatasetElementV11(name2, accessType, bufferNames, relations); }
public static DataRelationElementV11 fromDebugSegment(byte[] segment, int currentPos, int textAreaOffset, ByteOrder order) { int flags = ByteBuffer.wrap(segment, currentPos + 2, Short.BYTES).order(order).getShort(); int parentBufferNameOffset = ByteBuffer.wrap(segment, currentPos + 8, Integer.BYTES).order(order).getInt(); String parentBufferName = parentBufferNameOffset == 0 ? "" : RCodeInfo.readNullTerminatedString(segment, textAreaOffset + parentBufferNameOffset); int childBufferNameOffset = ByteBuffer.wrap(segment, currentPos + 12, Integer.BYTES).order(order).getInt(); String childBufferName = childBufferNameOffset == 0 ? "" : RCodeInfo.readNullTerminatedString(segment, textAreaOffset + childBufferNameOffset); int nameOffset = ByteBuffer.wrap(segment, currentPos + 16, Integer.BYTES).order(order).getInt(); String name = nameOffset == 0 ? "" : RCodeInfo.readNullTerminatedString(segment, textAreaOffset + nameOffset); int fieldPairsOffset = ByteBuffer.wrap(segment, currentPos + 20, Integer.BYTES).order(order).getInt(); String fieldPairs = fieldPairsOffset == 0 ? "" : RCodeInfo.readNullTerminatedString(segment, textAreaOffset + fieldPairsOffset); return new DataRelationElementV11(name, parentBufferName, childBufferName, fieldPairs, flags); }