because we use a ring buffer type construct, and don't actually shuffle items in the array, we need to figure out the real index to use. package private for unit tests @param index The index from the hpack @return the real index into the array
(int index)
| 300 | * @return the real index into the array |
| 301 | */ |
| 302 | int getRealIndex(int index) throws HpackException { |
| 303 | int dynamicIndex = index - Hpack.STATIC_TABLE_LENGTH; |
| 304 | // The index is one based, but our table is zero based |
| 305 | // Also, because of our ring buffer set up, the indexes are reversed |
| 306 | // index = 1 is at position firstSlotPosition + filledSlots |
| 307 | if (dynamicIndex < 1 || dynamicIndex > filledTableSlots) { |
| 308 | throw new HpackException(sm.getString("hpackdecoder.headerTableIndexInvalid", Integer.valueOf(index), |
| 309 | Integer.valueOf(Hpack.STATIC_TABLE_LENGTH), Integer.valueOf(filledTableSlots))); |
| 310 | } |
| 311 | return (firstSlotPosition + (filledTableSlots - dynamicIndex)) % headerTable.length; |
| 312 | } |
| 313 | |
| 314 | private void addStaticTableEntry(int index) throws HpackException { |
| 315 | // adds an entry from the static table. |
no test coverage detected