Returns the length of a line in UTF32 characters
@return	the length in UTF32 characters
@since	2.1.2
190456
public int GetLineLengthUtf32() {
        int total = 0;
        for (Iterator i = line.iterator(); i.hasNext();) {
            total += ((PdfChunk)i.next()).lengthUtf32();
        }
        return total;
    }
784645
public int length() {
        int length = 1 + 2 + deviceToken.length + 2 + payload.length;
        final int marshalledLength = marshall().length;
        assert marshalledLength == length;
        return length;
    }
1120259
public int readLength() throws IOException {
		int length = 0;

		byte b = (byte) this.read();

		// This is short form. The short form can be used if the number of
		// octets in the Value part is less than or
		// equal to 127, and can be used whether the Value part is primitive or
		// constructed. This form is identified by
		// encoding bit 8 as zero, with the length count in bits 7 to 1 (as
		// usual, with bit 7 the most significant bit
		// of the length).
		if ((b & 0x80) == 0) {
			return b;
		}

		// This is indefinite form. The indefinite form of length can only be
		// used (but does not have to be) if the V
		// part is constructed, that
		// is to say, consists of a series of TLVs. In the indefinite form of
		// length the first bit of the first octet is
		// set to 1, as for the long form, but the value N is set to zero.
		b = (byte) (b & 0x7F);
		if (b == 0) {
			return Tag.Indefinite_Length;
		}

		// If bit 8 of the first length octet is set to 1, then we have the long
		// form of length. In long form, the first
		// octet encodes in its remaining seven bits a value N which is the
		// length of a series of octets that themselves
		// encode the length of the Value part.
		byte temp;
		for (int i = 0; i < b; i++) {
			temp = (byte) this.read();
			length = (length << 8) | (0x00FF & temp);
		}

		return length;
	}
697865
public long getLength()
  {
    StreamSource indirectSource = _indirectSource;
    
    if (indirectSource != null) {
      return indirectSource.getLength();
    }
    
    TempOutputStream out = _out;
    
    if (out != null) {
      return out.getLength();
    }
    else {
      return -1;
    }
  }
1347537
protected void computeLineLengths()
    {
        firstLineLength = -1;
        lastLineLength = 0;
        longestLineLength = 0;
        
        String t = getText();
        FontMetrics fm = g.getFontMetrics();
        
        int s1 = 0;
        int s2 = t.indexOf('\r');
        int w = 0;
        do
        {
            if (s2 == -1)
                s2 = t.length();
            else
                containsLineBreak = true;
            w = stringWidth(fm, t.substring(s1, s2));
            if (firstLineLength == -1) firstLineLength = w;
            if (w > longestLineLength) longestLineLength = w;
            s1 = s2 + 1;
            s2 = t.indexOf('\r', s1);
        } while (s1 < t.length() && s2 < t.length());
        lastLineLength = w;
    }
419
public int readRawLittleEndian32() throws IOException
    {
        final byte[] buffer = this.buffer;
        int offset = this.offset;

        final byte b1 = buffer[offset++];
        final byte b2 = buffer[offset++];
        final byte b3 = buffer[offset++];
        final byte b4 = buffer[offset++];

        this.offset = offset;

        return (((int) b1 & 0xff)) |
                (((int) b2 & 0xff) << 8) |
                (((int) b3 & 0xff) << 16) |
                (((int) b4 & 0xff) << 24);
    }
287562
@Override
  public int encodedLength(CharSequence in) {
    final Cache cache = CACHE.get();
    int estimated = (int) (in.length() * cache.encoder.maxBytesPerChar());
    if (cache.lastOutput == null || cache.lastOutput.capacity() < estimated) {
      cache.lastOutput = ByteBuffer.allocate(Math.max(128, estimated));
    }
    cache.lastOutput.clear();
    cache.lastInput = in;
    CharBuffer wrap = (in instanceof CharBuffer) ?
                          (CharBuffer) in : CharBuffer.wrap(in);
    CoderResult result = cache.encoder.encode(wrap, cache.lastOutput, true);
    if (result.isError()) {
      try {
        result.throwException();
      } catch (CharacterCodingException e) {
        throw new IllegalArgumentException("bad character encoding", e);
      }
    }
    return cache.lastOutput.remaining();
  }
948474
public int getMessageLength() {
		// Message type
		int messageLength = 1;

		// Number of aliases
		messageLength += 4;

		if (this.aliases != null) {
			for (AttributeAlias alias : this.aliases) {
				// Alias number, name length
				messageLength += 8;
				try {
					messageLength += alias.attributeName.getBytes("UTF-16BE").length;
				} catch (UnsupportedEncodingException e) {
					log.error("Unable to encode strings into UTF-16.");
					e.printStackTrace();
				}
			}
		}

		return messageLength;
	}
1192886
function getLengthOfLength(lenValue, indefiniteLength) {
  var lenOfLen;
  
  if (indefiniteLength) {
    lenOfLen = 3;
  } else if (lenValue > 0x00FFFFFF) {
    lenOfLen = 5;
  } else if (lenValue > 0x0000FFFF) {
    lenOfLen = 4;
  } else if (lenValue > 0x000000FF) {
    lenOfLen = 3;
  } else if (lenValue > 0x0000007F) {
    lenOfLen = 2; 
  } else {
    lenOfLen = 1;
  }
  
  return lenOfLen
}
21494
public int getLength()
  {
    int length = 0;
    
    for (TempCharBuffer ptr = _head; ptr != null; ptr = ptr._next) {
      length += ptr.getLength();
    }

    return length;
  }
1368239
public int getLength() {
        int count=0;
        for (int handle=m_firstChild;
             handle!=DTM.NULL;
             handle=m_parentDTM.getNextSibling(handle)) {
            ++count;
        }
        return count;
    }
1049578
public int getMessageLength() {
		int length = 1;

		if (this.matchingIds != null) {
			for (String id : this.matchingIds) {
				try {
					length += 4;
					length += id.getBytes("UTF-16BE").length;
				} catch (UnsupportedEncodingException uee) {
					log.error("Unable to encode UTF-16BE String: {}", uee);
				}
			}
		}
		return length;
	}
905589
static int getLength(int lenByte, InputStream in) throws IOException {
        int value, tmp;

        tmp = lenByte;
        if ((tmp & 0x080) == 0x00) { // short form, 1 byte datum
            value = tmp;
        } else {                     // long form or indefinite
            tmp &= 0x07f;

            /*
             * NOTE:  tmp == 0 indicates indefinite length encoded data.
             * tmp > 4 indicates more than 4Gb of data.
             */
            if (tmp == 0)
                return -1;
            if (tmp < 0 || tmp > 4)
                throw new IOException("DerInputStream.getLength(): lengthTag="
                    + tmp + ", "
                    + ((tmp < 0) ? "incorrect DER encoding." : "too big."));

            for (value = 0; tmp > 0; tmp --) {
                value <<= 8;
                value += 0x0ff & in.read();
            }
            if (value < 0) {
                throw new IOException("DerInputStream.getLength(): "
                        + "Invalid length bytes");
            }
        }
        return value;
    }
927749
public int length()
    {
        int length = description.length();
        synchronized (fields)
        {
            length = fields.stream().map(f -> f.getName().length() + f.getValue().length()).reduce(length, Integer::sum);
        }
        if (title != null)
            length += title.length();
        if (author != null)
            length += author.getName().length();
        if (footer != null)
            length += footer.getText().length();
        return length;
    }
1245290
private String readLine(InputStream in) throws IOException {
	StringBuffer buf = new StringBuffer();
	int c, length = 0;

	while(true) {
	    c = in.read();
	    if (c == -1 || c == '\n' || length > 512) {
		break;
	    } else if (c == '\r') {
		in.read();
		return buf.toString();
	    } else {
		buf.append((char)c);
		length++;
	    }

	}
	return buf.toString();
    }
34026
final int getMinLength() {
		switch (this.type) {
		case CONCAT:
			int sum = 0;
			for (int i = 0; i < this.size(); i++)
				sum += this.getChild(i).getMinLength();
			return sum;

		case CONDITION:
		case UNION:
			if (this.size() == 0)
				return 0;
			int ret = this.getChild(0).getMinLength();
			for (int i = 1; i < this.size(); i++) {
				int min = this.getChild(i).getMinLength();
				if (min < ret)
					ret = min;
			}
			return ret;

		case CLOSURE:
		case NONGREEDYCLOSURE:
			if (this.getMin() >= 0)
				return this.getMin() * this.getChild(0).getMinLength();
			return 0;

		case EMPTY:
		case ANCHOR:
			return 0;

		case DOT:
		case CHAR:
		case RANGE:
		case NRANGE:
			return 1;

		case INDEPENDENT:
		case PAREN:
		case MODIFIERGROUP:
			return this.getChild(0).getMinLength();

		case BACKREFERENCE:
			return 0; // *******

		case STRING:
			return this.getString().length();

		case LOOKAHEAD:
		case NEGATIVELOOKAHEAD:
		case LOOKBEHIND:
		case NEGATIVELOOKBEHIND:
			return 0; // ***** Really?

		default:
			throw new RuntimeException("Token#getMinLength(): Invalid Type: "
					+ this.type);
		}
	}
753462
private int commonPrefixLength() {
        // shorterText和longerText已经在父类JaroDistanceTextSimilarity中准备好了
        // 这里直接用就可以
        int result = 0;
        int len = shorterText.length();
        for (int i = 0; i < len; i++) {
            if (shorterText.charAt(i) != longerText.charAt(i)) {
                break;
            }
            result++;
            if(result >= MAXIMUM_CHARACTERS){
                // 最多4个字符即可
                return MAXIMUM_CHARACTERS;
            }
        }
        return result;
    }