Read all the items in this heap, returning the identified root item and an array of all items contained therein. @return @throws IOException
()
| 52 | * @throws IOException |
| 53 | */ |
| 54 | protected Pair<Integer, Item[]> readItems() throws IOException { |
| 55 | // first, write magic number |
| 56 | Schema schema = checkHeader(); |
| 57 | // second, determine number of items |
| 58 | int size = in.read_uv(); |
| 59 | // third, determine the root item |
| 60 | int root = in.read_uv(); |
| 61 | // |
| 62 | Bytecode[] items = new Bytecode[size]; |
| 63 | // third, read abstract syntactic items |
| 64 | for (int i = 0; i != items.length; ++i) { |
| 65 | items[i] = readItem(schema); |
| 66 | } |
| 67 | // |
| 68 | return new Pair<>(root, constructItems(schema, items)); |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Check the header of this syntactic heap and, based on this, select the most |
no test coverage detected