Gets the length of an ASN.1 value.

In case the length is not specified, undefined is returned.

@param b the ASN.1 byte buffer.

@return the length of the ASN.1 value.
978616
function(b) {
  var b2 = b.getByte();
  if(b2 === 0x80) {
    return undefined;
  }

  // see if the length is "short form" or "long form" (bit 8 set)
  var length;
  var longForm = b2 & 0x80;
  if(!longForm) {
    // length is just the first byte
    length = b2;
  } else {
    // the number of bytes the length is specified in bits 7 through 1
    // and each length byte is in big-endian base-256
    length = b.getInt((b2 & 0x7F) << 3);
  }
  return length;
}
980904
public static int sizeOfIA5String(String value) {
        return DerUtils.sizeOf(ASN1_IA5STRING_TAG_NUM, (value == null) ? 0 : value.getBytes().length);
    }
739057
public int getSize()
  {
    int size = length();
    
    if (_blobs == null) {
      return size;
    }
    
    for (BlobOutputStream blob : _blobs) {
      if (blob != null) {
        size += blob.getSize();
      }
    }
    
    return size;
  }
1354913
public int getBlockLength(final DirectBuffer buffer, final int bufferOffset)
    {
        return Types.getInt(buffer, bufferOffset + blockLengthOffset, blockLengthType, blockLengthByteOrder);
    }
1265555
public int getLength() {
        int length = 8;

        int size = mAttributes.size();
        for (int i=0; i<size; i++) {
            length += mAttributes.get(i).getLength();
        }

        return length;
    }
1018742
public static int lengthOf(WsByteBuffer[] src, int startIndex) {
        int length = 0;
        if (null != src) {
            for (int i = startIndex; i < src.length && null != src[i]; i++) {
                length += src[i].remaining();
            }
        }
        return length;
    }
803323
function getStringBufferLength(hexStr) {
  const _tmpBuf = Buffer.from(hexStr, 'hex').length;
  return Buffer.from([_tmpBuf]).toString('hex');
}
965978
public int length() {
        try {
            final StringBuilder s = read(MIN_LENGTH);
            pushBack.append(s);
            return s.length();
        } catch (IOException ex) {
            LOGGER.warn("Oops ", ex);
        }
        return 0;
    }
150375
public int read(byte []buf, int offset, int length)
    throws IOException
  {
    try {
      if (_s == null || _is == null)
        return -1;

      int readLength = _is.read(buf, offset, length);

      if (readLength >= 0)
        _totalReadBytes += readLength;

      return readLength;
    } catch (InterruptedIOException e) {
      if (_throwReadInterrupts)
        throw e;
      
      log.log(Level.FINEST, e.toString(), e);
    } catch (IOException e) {
      if (_throwReadInterrupts)
        throw e;

      log.log(Level.FINER, e.toString(), e);
    }

    return -1;
  }
1300981
@Override
	public long getBits(int position, int length) {
		checkBitsLength(length);
		return getBitsAdj(adjPosition(position, length), length);
	}
1318144
def get_value_length(byte):
    
    length_value = byte & length_type_mask
    return LengthTypes.to_ints.get(length_value, byte & length_mask)
1293685
def length(self):
        
        if isinstance(self._value, int):
            return byte_len(self._value)
        if self._value is None:
            return 0
        return len(self._value)
544339
public Integer getLength()
   {
      if(childNode.getAttribute("length") != null && !childNode.getAttribute("length").equals("null"))
      {
         return Integer.valueOf(childNode.getAttribute("length"));
      }
      return null;
   }
784645
public int length() {
        int length = 1 + 2 + deviceToken.length + 2 + payload.length;
        final int marshalledLength = marshall().length;
        assert marshalledLength == length;
        return length;
    }
536389
@Override
  public int read(byte[] b, int start, int length) throws IOException {
    if (!readMetaDataIfNeeded()) {
      return -1;
    }
    int toRead = (int)Math.min(length, getCompleteBlockSize() - rawBlockOffset);
    int read = in.read(b, start, toRead);
    if (read >= 0) {
      moveForward(read);
    } else {
      eofReached = true;
    }
    return read;
  }
387760
private static int get16(byte[] b, int off) {
        return Byte.toUnsignedInt(b[off]) | ( Byte.toUnsignedInt(b[off+1]) << 8);
    }
1358170
public int readInt(byte []buf, int offset, int length) throws IOException
  {
    if (! _didGet) {
      getConnInput();
    }

    if (_isRequestDone) {
      return -1;
    }

    try {
      int len = length;

      if (_isChunked) {
        if (_chunkLength == 0) {
          int ch;

          for (ch = _rs.read();
               ch >= 0 && (ch == '\r' || ch == '\n' || ch == ' ');
               ch = _rs.read()) {
          }
        
          for (; ch >= 0 && ch != '\n'; ch = _rs.read()) {
            if (ch >= '0' && ch <= '9')
              _chunkLength = 16 * _chunkLength + ch - '0';
            else if (ch >= 'a' && ch <= 'f')
              _chunkLength = 16 * _chunkLength + ch - 'a' + 10;
            else if (ch >= 'A' && ch <= 'F')
              _chunkLength = 16 * _chunkLength + ch - 'A' + 10;
          }

          if (_chunkLength == 0) {
            _isRequestDone = true;
            return -1;
          }
        }
        else if (_chunkLength < 0)
          return -1;
      
        if (_chunkLength < len)
          len = _chunkLength;
      }
      else if (_contentLength < 0) {
      }
      else if (_contentLength == 0) {
        _isRequestDone = true;
        return -1;
      }
      else if (_contentLength < len)
        len = _contentLength;

      len = _rs.read(buf, offset, len);

      if (len < 0) {
      }
      else if (_isChunked)
        _chunkLength -= len;
      else if (_contentLength > 0)
        _contentLength -= len;

      return len;
    } catch (IOException e) {
      _isKeepalive = false;
      throw e;
    } catch (RuntimeException e) {
      _isKeepalive = false;
      throw e;
    }
  }