|
iRex DR1000 Manager v0.6 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.andynaz.irex.dr1000.scribble.Parser
public class Parser
Parses the blob to create the pages with the scribbles.
The scribbles are organized as a list of Stroke
objects, which have a
list of Stroke.Point
objects.
Scribbles are stored in the annotations.data
column (see
documentation of class ScribbleMgr
for information about the structure of the database), as a binary blob with
the following structure.
The not-used parts are represented in gray (in this case the meaning is not
sure) and the bytes in the examples are represented as a couple of
hexadecimal digits. Note that the bytes are stored in a reversed order, so
that the pair of bytes "01 00" has to be read as the hex number "0001", which
corresponds to 1 (and not to 256)
The first 40 bytes are the ones related to the page data:
length | type | meaning | example |
---|---|---|---|
2 | version | 01 00 | |
4 | orientation | 00 00 00 00 | |
8 | page_pixel | 00 00 00 00 00 00 00 00 | |
2 | page_r | 00 00 | |
2 | page_g | 00 00 | |
2 | page_b | 00 00 | |
4 | ul_x | 00 00 00 00 | |
4 | ul_y | 00 00 00 00 | |
4 | lr_x | D7 04 00 00 | |
4 | lr_y | DA 06 00 00 | |
4 | int | number of strokes | A3 00 00 00 |
Only the last one is actually used, as it indicates the number of strokes in the page.
After that 40 bytes, there are the strokes.
Each stroke begin with a 24-bytes sequence, representing the properties of a
stroke, and the list of points.
The 24 bytes are strucutred according to the following schema:
length | type | meaning | example |
---|---|---|---|
4 | color | 03 00 00 00 | |
4 | float | zoom | D7 A0 89 42 |
4 | layer | 00 00 00 00 | |
4 | shape | 00 00 00 00 | |
4 | int | width | 01 00 00 00 |
4 | int | number of points | 35 00 00 00 |
Each point is represented as a 12-bytes blocks:
length | type | meaning | example |
---|---|---|---|
4 | int | x coordinate | 48 00 00 00 |
4 | int | y coordinate | 6C 00 00 00 |
4 | pressure | 00 00 00 00 |
After the sequence of points, another stroke begins (or the end of the blob is reached).
Constructor Summary | |
---|---|
private |
Parser()
|
Method Summary | |
---|---|
static Page |
build(byte[] blob)
Create a Page from the blob. |
private static void |
safeSkip(ByteArrayInputStream bIn,
long l)
Skips l bytes from the ByteArrayInputStream bIn . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
private Parser()
Method Detail |
---|
public static Page build(byte[] blob) throws IOException
Stroke
objects inside the Page
object.
blob
- the blob, as taken from the SQLite database file
null
if the
blob
array is empty or null
IOException
- in an error occours while reading the blobprivate static void safeSkip(ByteArrayInputStream bIn, long l) throws IOException
l
bytes from the ByteArrayInputStream bIn
.
After skipping, check if the actually skipped bytes are exactly l
;
if not, throws an IOException (the number of bytes actually skipped is in
the IOException message).
bIn
- stream from whom skip the bytesl
- number of bytes to skip
IOException
- if the method skipped less than l
bytes or if
an IO error occours
|
iRex DR1000 Manager v0.6 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |