FirmwareImage implements Chunk.Chunkable { public byte[] metadata() { ByteBuffer buffer = ByteBuffer.allocate(12); buffer.put(intToTwoBytes(intVersion(), Constants.CC2540_BYTE_ORDER)); buffer.put(intToTwoBytes(length(), Constants.CC2540_BYTE_ORDER)); buffer.put(uniqueID()); buffer.put(reserved()); return buffer.array(); } FirmwareImage(byte[] rawData, String filename); byte[] data(); String name(); int sizeBytes(); long version(); @Override byte[] getChunkableData(); int crc(); int crcShadow(); int intVersion(); int length(); byte[] uniqueID(); byte[] reserved(); byte[] metadata(); int blockCount(); byte[] block(int index);  }
@Test public void testMetadata() throws ImageParsingException { FirmwareImage image = new FirmwareImage(rawImageData_valid, ""); assertThat(image.metadata()).isEqualTo(intArrayToByteArray(new int[] { 0x64, 0x00, 0x00, 0x7C, 0x41, 0x41, 0x41, 0x41, 0xFF, 0xFF, 0xFF, 0xFF })); }