Check that the block size is what we expect.

@param descriptor the descriptor bytes
@throws IOException
429828
private void validateBlockSize(byte[] descriptor) throws IOException {
        int blockSize = Util.getUInt16Both(descriptor, 129);
        if (blockSize != Constants.DEFAULT_BLOCK_SIZE) {
            throw new LoopFileSystemException("Invalid block size: " + blockSize);
        }
    }
447614
public void checkSize(int length, boolean huffman) throws HpackException.SessionException {
        // Apply a huffman fudge factor
        if (huffman)
            length = (length * 4) / 3;
        if ((_size + length) > _maxSize)
            throw new HpackException.SessionException("Header too large %d > %d", _size + length, _maxSize);
    }
886626
@Override
    public void setExpectedMaxSize( int numRows , int numCols ) {
        super.setExpectedMaxSize(numRows,numCols);

        // if the matrix that is being decomposed is smaller than the block we really don't
        // see the B matrix.
        if( numRows < blockWidth)
            B = new DMatrixRMaj(0,0);
        else
            B = new DMatrixRMaj(blockWidth,maxWidth);

        chol = new CholeskyBlockHelper_DDRM(blockWidth);
    }
647703
public long size(String fileName) {
		try {
			IoChannel fileChannel = getFileChannel(fileName);
			return fileChannel.size() / BLOCK_SIZE;
		} catch (IOException e) {
			throw new RuntimeException("cannot access " + fileName);
		}
	}
213307
static int block4(FileDescriptor fd, int group, int interf, int source)
        throws IOException
    {
        return blockOrUnblock4(true, fd, group, interf, source);
    }
1339642
def instruction_size(self, insn_addr):
        

        for b in self.blocks:
            block = self._get_block(b.addr, size=b.size, byte_string=b.bytestr)
            if insn_addr in block.instruction_addrs:
                index = block.instruction_addrs.index(insn_addr)
                if index == len(block.instruction_addrs) - 1:
                    # the very last instruction
                    size = block.addr + block.size - insn_addr
                else:
                    size = block.instruction_addrs[index + 1] - insn_addr
                return size

        return None
1024159
public int getSizeOfSurroundingTryBlock(String vmNameOfExceptionClass, int pc) {
        if (code == null) {
            throw new IllegalStateException("Not visiting Code");
        }
        return Util.getSizeOfSurroundingTryBlock(constantPool, code, vmNameOfExceptionClass, pc);
    }
682827
def new(self, log_block_size):
        # type: (int) -> None
        '''
        
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('This Version Volume Descriptor is already initialized')

        self._data = b'\x00' * log_block_size
        self._initialized = True
1085348
private void prepareForWrite(long pos, long len) throws IOException {
    long end = pos + len;

    // allocate any additional blocks needed
    int lastBlockIndex = blockCount - 1;
    int endBlockIndex = blockIndex(end - 1);

    if (endBlockIndex > lastBlockIndex) {
      int additionalBlocksNeeded = endBlockIndex - lastBlockIndex;
      disk.allocate(this, additionalBlocksNeeded);
    }

    // zero bytes between current size and pos
    if (pos > size) {
      long remaining = pos - size;

      int blockIndex = blockIndex(size);
      byte[] block = blocks[blockIndex];
      int off = offsetInBlock(size);

      remaining -= zero(block, off, length(off, remaining));

      while (remaining > 0) {
        block = blocks[++blockIndex];

        remaining -= zero(block, 0, length(remaining));
      }

      size = pos;
    }
  }
32886
static int block6(FileDescriptor fd, byte[] group, int index, byte[] source)
        throws IOException
    {
        return blockOrUnblock6(true, fd, group, index, source);
    }
711751
def _compute_chunk_size(self):
        # type: (Descriptor) -> int
        
        if self._src_block_list is not None:
            blen = len(self._src_block_list)
            if blen == 0:
                # this is a one-shot block blob
                return self._src_ase.size
            elif blen == 1:
                return self._src_block_list[0].size
            else:
                return -1
        else:
            return _MAX_NONBLOCK_BLOB_CHUNKSIZE_BYTES
660664
def _AddByteSizeMethod(message_descriptor, cls):
  """"""

  def ByteSize(self):
    if not self._cached_byte_size_dirty:
      return self._cached_byte_size

    size = 0
    for field_descriptor, field_value in self.ListFields():
      size += field_descriptor._sizer(field_value)

    for tag_bytes, value_bytes in self._unknown_fields:
      size += len(tag_bytes) + len(value_bytes)

    self._cached_byte_size = size
    self._cached_byte_size_dirty = False
    self._listener_for_children.dirty = False
    return size

  cls.ByteSize = ByteSize
283908
function checkDescriptor(descriptor, err){
	if(typeof descriptor != 'object') return false;
	
	for(var key in CONST.descriptorType){
		if(!checkType(descriptor[key], CONST.descriptorType[key])){
			err.key = key;
			err.expect = CONST.descriptorType[key];
			err.type = typeof descriptor[key];
			return false;
		}
	}

	for(var key in CONST.descriptorOptType){
		if(typeof descriptor[key] != 'undefined' && checkType(descriptor[key], CONST.descriptorOptType[key].type)) continue;
		if(typeof descriptor[key] == 'undefined'){
			if(typeof CONST.descriptorOptType[key].value != 'undefined') descriptor[key] = CONST.descriptorOptType[key].value;
			continue;
		}

		err.key = key;
		err.expect = CONST.descriptorOptType[key].type;
		err.type = typeof descriptor[key];
		return false;
	}

	return true;
}
802471
public MatrixSize readCoordinateSize() throws IOException {
        int numRows = getInt(), numColumns = getInt(), numEntries = getInt();

        return new MatrixSize(numRows, numColumns, numEntries);
    }
1117412
private void deserializeSupplementary(byte[] descriptor) throws IOException {
        // for now, only recognize one supplementary descriptor
        if (this.hasSupplementary) {
            return;
        }

        validateBlockSize(descriptor);

        String escapeSequences = Util.getDChars(descriptor, 89, 32);

        String enc = getEncoding(escapeSequences);

        if (null != enc) {
            this.encoding = enc;
            this.escapeSequences = escapeSequences;

            deserializeCommon(descriptor);

            this.hasSupplementary = true;
        } else {
            log.warn("Unsupported encoding, escapeSequences: '" + this.escapeSequences + "'");
        }
    }
292277
static void checkMethodDesc(final String desc) {
        if (desc == null || desc.length() == 0) {
            throw new IllegalArgumentException(
                    "Invalid method descriptor (must not be null or empty)");
        }
        if (desc.charAt(0) != '(' || desc.length() < 3) {
            throw new IllegalArgumentException("Invalid descriptor: " + desc);
        }
        int start = 1;
        if (desc.charAt(start) != ')') {
            do {
                if (desc.charAt(start) == 'V') {
                    throw new IllegalArgumentException("Invalid descriptor: "
                            + desc);
                }
                start = checkDesc(desc, start, false);
            } while (start < desc.length() && desc.charAt(start) != ')');
        }
        start = checkDesc(desc, start + 1, true);
        if (start != desc.length()) {
            throw new IllegalArgumentException("Invalid descriptor: " + desc);
        }
    }
679495
private void writeHeader() throws IOException {
    final ByteBuffer headerBuffer = ByteBuffer.allocate(LZ4_MAX_HEADER_LENGTH).order(ByteOrder.LITTLE_ENDIAN);
    headerBuffer.putInt(MAGIC);
    headerBuffer.put(frameInfo.getFLG().toByte());
    headerBuffer.put(frameInfo.getBD().toByte());
    if (frameInfo.isEnabled(FLG.Bits.CONTENT_SIZE)) {
      headerBuffer.putLong(knownSize);
    }
    // compute checksum on all descriptor fields
    final int hash = (checksum.hash(headerBuffer.array(), INTEGER_BYTES, headerBuffer.position() - INTEGER_BYTES, 0) >> 8) & 0xFF;
    headerBuffer.put((byte) hash);
    // write out frame descriptor
    out.write(headerBuffer.array(), 0, headerBuffer.position());
  }