| 83 | } |
| 84 | |
| 85 | protected void readBlock(List<Map<String, Object>> contents) throws IOException { |
| 86 | int pt = this.pt; |
| 87 | blockLen = readInt(); |
| 88 | blockType = readString(4); |
| 89 | if (blockLen == 1) { |
| 90 | // special flag for long length not int |
| 91 | // presuming here it is not THAT large |
| 92 | blockLen = (int) is.readLong(); |
| 93 | } |
| 94 | if (verbose) |
| 95 | System.out.println(blockType + "\t" + pt + "\t0x" + Long.toHexString(pt) + "\t" + blockLen); |
| 96 | Map<String, Object> map = new Hashtable<>(); |
| 97 | map.put("_pt", pt); |
| 98 | map.put("_type", blockType); |
| 99 | map.put("_len", blockLen); |
| 100 | contents.add(map); |
| 101 | if (verbose) |
| 102 | System.out.println(map); |
| 103 | int remaining = readBlock(blockType, blockLen - 8, map); |
| 104 | if (remaining < 0) { |
| 105 | pt = -1; |
| 106 | return; |
| 107 | } |
| 108 | skip(remaining); |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Read a block and return the number of remaining bytes, usually 0. |