0

Products should be delivered to fictional stores. There's no store backend instance.

Product amount is unspecified. Just make sure that each store get what they are selling - one product can be delivered to multiple store, if needed.

After products are delivered a report should be printed to list stores with their assortment. The list of stores:

Grocery store (place that sells food)
Hardware store (place that sells tools)
Computer store (place that sells computers)
Gun shop (guns and ammo)
Wallmart (place that sells everything except guns)

product categories are:
food, tools, computers, guns, ammo

The attached file contains products definitions with attributes name and category in tlv format. The file doesn't contain garbage so no error handing is needed. However it's not forbidden either.

The tlv format specification is following:

length in bytes | description
        1       |     tag
        1       |     length
    <length>    |     value

The tag description is following:

product tag = 0x81
product category tag = 0x02, value type is string
product name tag = 0x03, value type is string

If the tag identifier's most significant bit is on it means that the value data consist multiple tlv values.

Example of one product:

81(tag) 0C(length) |02(tag) 04(length) 666f6f64(data) 03(tag) 05(length) 6170706c65(data)|

I am new to Java, know how to read text from csv file but don't have an idea, how to read in tlv. Any clue or help will be highly appreciated. The rest of the task I can do it myself. I have posted the whole task description just to give an understanding of what it is.

ab jatoi
  • 39
  • 6
  • check this link http://tlve.sourceforge.net/ and let me know if that give you and idea – AndroidStorm Aug 24 '17 at 22:38
  • What have you tried so far to parse the file? Also, you didn't provide a sample of you input file. Unless the input file looks exactly like the example product? – tima Aug 25 '17 at 01:00
  • Yes Input file is the same as a example product – ab jatoi Aug 25 '17 at 08:30
  • AndroidStorm these are separate tools and in this task i have to parse it through java code only. That is my limitation – ab jatoi Aug 25 '17 at 08:31

0 Answers0