docs: private static Dimension getDimension(InputStream fis, AtomicReference<ByteBuffer> lastTkhdHolder)
        throws IOException {
  
      while (fis.available() > 0) {
        byte[] header = new byte[8];
        fis.read(header);
  
        long size = readUint32(header, 0);
        String type = new String(header, 4, 4, "ISO-8859-1");
        if (containers.contains(type)) {
  
          Dimension dimension = getDimension(fis, lastTkhdHolder);
          if (dimension != null) {
            return dimension;
          }
  
        } else if (type.equals("tkhd")) {
          byte[] lastTkhd = new byte[(int) (size - 8)];
          lastTkhdHolder.set(ByteBuffer.wrap(lastTkhd));
          fis.read(lastTkhd);
        } else if (type.equals("hdlr")) {
          byte[] hdlr = new byte[(int) (size - 8)];
          fis.read(hdlr);
          if (hdlr[8] == 0x76 && hdlr[9] == 0x69 && hdlr[10] == 0x64 && hdlr[11] == 0x65) {
            byte[] lastTkhd = lastTkhdHolder.get().array();
            return new Dimension((int) readFixedPoint1616(lastTkhd, lastTkhd.length - 8),
                (int) readFixedPoint1616(lastTkhd, lastTkhd.length - 4));
          }
        } else {
          fis.skip(size - 8);
        }
      }
  
      return null;
    }