j123b567 / java-intelhex-parser

Java IntelHex parser library
15 stars 13 forks source link

IntelHexParseRangeDetector added; minor other changes. #2

Closed ruslan-yanchyshyn closed 9 years ago

ruslan-yanchyshyn commented 9 years ago

Now it is possible to use the following code:

IntelHexParser ihp = new IntelHexParser(in);
IntelHexParseRangeDetector rangeDetector = new IntelHexParseRangeDetector();
ihp.setDataListener(rangeDetector);
ihp.parse();

in.reset();
ByteArrayOutputStream bos = new ByteArrayOutputStream((int)rangeDetector.getLength());
IntelHexParserDemo ihpd = new IntelHexParserDemo(rangeDetector.getStart(), rangeDetector.getStart() + rangeDetector.getLength() - 1, bos);
ihp.setDataListener(ihpd);
ihp.parse();

byte[] data = bos.toByteArray();
j123b567 commented 9 years ago

Thank you for that modification. I made some further changes to cleanup the project and use RangeDetector in demo.