public class HexInputStream extends FilterInputStream
In nRF51 chips memory a SoftDevice starts at address 0x1000. From 0x0000 to 0x1000 there is MBR sector (since SoftDevice 7.0.0) which should not be transmitted using DFU. Therefore this class skips all data from addresses below 0x1000.
in| Constructor and Description |
|---|
HexInputStream(byte[] data,
int mbrSize)
Creates the HEX Input Stream.
|
HexInputStream(InputStream in,
int mbrSize)
Creates the HEX Input Stream.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
mark(int readlimit) |
int |
read() |
int |
read(byte[] buffer) |
int |
read(byte[] buffer,
int offset,
int count) |
int |
readPacket(byte[] buffer)
Fills the buffer with next bytes from the stream.
|
void |
reset() |
int |
sizeInBytes()
Returns the total number of bytes.
|
int |
sizeInPackets(int packetSize)
Returns the total number of packets with given size that are needed to get all
available data.
|
close, markSupported, skippublic HexInputStream(InputStream in, int mbrSize) throws HexFileValidationException, IOException
sizeInBytes(). If HEX file is invalid then the bin size is 0.in - the input stream to read from.mbrSize - the MBR (Master Boot Record) size in bytes. Data with addresses below than
number will be trimmed and not transferred to DFU target.HexFileValidationException - if HEX file is invalid, e.g. there is no semicolon (':')
on the beginning of each line.IOException - if the stream is closed or another IOException occurs.public HexInputStream(byte[] data,
int mbrSize)
throws HexFileValidationException,
IOException
sizeInBytes(). If HEX file is invalid then the bin size is 0.data - the input stream to read from.mbrSize - the MBR (Master Boot Record) size in bytes. Data with addresses below than
* number will be trimmed and not transferred to DFU target.HexFileValidationException - if HEX file is invalid, e.g. there is no semicolon (':')
on the beginning of each line.IOException - if the stream is closed or another IOException occurs.public int available()
available in class FilterInputStreampublic int readPacket(byte[] buffer)
throws IOException
buffer - buffer to be filledIOExceptionpublic int read()
read in class FilterInputStreampublic int read(byte[] buffer)
throws IOException
read in class FilterInputStreamIOExceptionpublic int read(byte[] buffer,
int offset,
int count)
read in class FilterInputStreampublic int sizeInBytes()
public int sizeInPackets(int packetSize)
packetSize - the maximum packet sizepublic void mark(int readlimit)
mark in class FilterInputStreampublic void reset()
throws IOException
reset in class FilterInputStreamIOException