public class HexInputStream
extends java.io.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.
| Constructor and Description |
|---|
HexInputStream(byte[] data,
int mbrSize) |
HexInputStream(java.io.InputStream in,
int mbrSize)
Creates the HEX Input Stream.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
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
|
public HexInputStream(java.io.InputStream in,
int mbrSize)
throws HexFileValidationException,
java.io.IOException
sizeInBytes(). If HEX file is invalid then the bin size is 0.in - the input stream to read frommbrSize - 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. F.e. there is no semicolon (':') on the beginning of each line.java.io.IOException - if the stream is closed or another IOException occurs.public HexInputStream(byte[] data,
int mbrSize)
throws HexFileValidationException,
java.io.IOException
HexFileValidationExceptionjava.io.IOExceptionpublic int available()
available in class java.io.FilterInputStreampublic int readPacket(byte[] buffer)
throws HexFileValidationException,
java.io.IOException
buffer - buffer to be filledjava.io.IOExceptionHexFileValidationExceptionpublic int read()
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int read(byte[] buffer)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int read(byte[] buffer,
int offset,
int count)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int sizeInBytes()
public int sizeInPackets(int packetSize)
throws java.io.IOException
packetSize - the maximum packet sizejava.io.IOExceptionpublic void reset()
throws java.io.IOException
reset in class java.io.FilterInputStreamjava.io.IOException