docs: private void readBlock() throws IOException {
      int blockSize = readInt(in);
      final boolean compressed = (blockSize & LZ4FrameOutputStream.LZ4_FRAME_INCOMPRESSIBLE_MASK) == 0;
      blockSize &= ~LZ4FrameOutputStream.LZ4_FRAME_INCOMPRESSIBLE_MASK;
  
      // Check for EndMark
      if (blockSize == 0) {
        if (frameInfo.isEnabled(LZ4FrameOutputStream.FLG.Bits.CONTENT_CHECKSUM)) {
          final int contentChecksum = readInt(in);
          if (contentChecksum != frameInfo.currentStreamHash()) {
            throw new IOException("Content checksum mismatch");
          }
        }
        if (frameInfo.isEnabled(LZ4FrameOutputStream.FLG.Bits.CONTENT_SIZE) && expectedContentSize != totalContentSize) {
  	throw new IOException("Size check mismatch");
        }
        frameInfo.finish();
        return;
      }
  
      final byte[] tmpBuffer; // Use a temporary buffer, potentially one used for compression
      if (compressed) {
        tmpBuffer = compressedBuffer;
      } else {
        tmpBuffer = rawBuffer;
      }
      if (blockSize > maxBlockSize) {
        throw new IOException(String.format(Locale.ROOT, "Block size %s exceeded max: %s", blockSize, maxBlockSize));
      }
  
      int offset = 0;
      while (offset < blockSize) {
        final int lastRead = in.read(tmpBuffer, offset, blockSize - offset);
        if (lastRead < 0) {
          throw new IOException(PREMATURE_EOS);
        }
        offset += lastRead;
      }
  
      // verify block checksum
      if (frameInfo.isEnabled(LZ4FrameOutputStream.FLG.Bits.BLOCK_CHECKSUM)) {
        final int hashCheck = readInt(in);
        if (hashCheck != checksum.hash(tmpBuffer, 0, blockSize, 0)) {
          throw new IOException(BLOCK_HASH_MISMATCH);
        }
      }
  
      final int currentBufferSize;
      if (compressed) {
        try {
          currentBufferSize = decompressor.decompress(tmpBuffer, 0, blockSize, rawBuffer, 0, rawBuffer.length);
        } catch (LZ4Exception e) {
          throw new IOException(e);
        }
      } else {
        currentBufferSize = blockSize;
      }
      if (frameInfo.isEnabled(LZ4FrameOutputStream.FLG.Bits.CONTENT_CHECKSUM)) {
        frameInfo.updateStreamHash(rawBuffer, 0, currentBufferSize);
      }
      totalContentSize += currentBufferSize;
      buffer.limit(currentBufferSize);
      buffer.rewind();
    }