public static boolean checkDataIntegrity(byte[] data, int offset, int expectedNewOffset) { int dMonListBinCount = ByteConversions.getIntegerInByteArrayAtPosition(data, offset); offset += 4; offset += dMonListBinCount * DMONLIST_BIN_RECORD_SIZE; return (offset == expectedNewOffset); }
public static int populateObjects(byte[] data, int offset, List dMonListBinList) { int dMonListBinCount = ByteConversions.getIntegerInByteArrayAtPosition(data, offset); offset += 4; for (int dMonListBinIndex = 0; dMonListBinIndex < dMonListBinCount; ++dMonListBinIndex) { DMonListBinMM6 dMonListBin = new DMonListBinMM6(); dMonListBinList.add(dMonListBin); offset = dMonListBin.initialize(data, offset); } return offset; }
public static int updateData(byte[] newData, int offset, List dMonListBinList) { ByteConversions.setIntegerInByteArrayAtPosition(dMonListBinList.size(), newData, offset); offset += 4; for (int dMonListBinIndex = 0; dMonListBinIndex < dMonListBinList.size(); ++dMonListBinIndex) { DMonListBinMM6 dMonListBin = (DMonListBinMM6) dMonListBinList.get(dMonListBinIndex); System.arraycopy( dMonListBin.getDMonListBinData(), 0, newData, offset, dMonListBin.getDMonListBinData().length); offset += dMonListBin.getDMonListBinData().length; } return offset; }