org.apache.tomcat.util.buf.Ascii.isDigit()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中org.apache.tomcat.util.buf.Ascii.isDigit()方法的一些代码示例,展示了Ascii.isDigit()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ascii.isDigit()方法的具体详情如下:
包路径:org.apache.tomcat.util.buf.Ascii
类名称:Ascii
方法名:isDigit

Ascii.isDigit介绍

[英]Returns true if the specified ASCII character is a digit.
[中]如果指定的ASCII字符是数字,则返回true。

代码示例

代码示例来源:origin: org.apache.coyote.springsource/com.springsource.org.apache.coyote.springsource

  1. public static int parseInt(char[] b, int off, int len)
  2. throws NumberFormatException
  3. {
  4. int c;
  5. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  6. throw new NumberFormatException();
  7. }
  8. int n = c - '0';
  9. while (--len > 0) {
  10. if (!isDigit(c = b[off++])) {
  11. throw new NumberFormatException();
  12. }
  13. n = n * 10 + c - '0';
  14. }
  15. return n;
  16. }

代码示例来源:origin: jboss.web/jbossweb

  1. public static int parseInt(char[] b, int off, int len)
  2. throws NumberFormatException
  3. {
  4. int c;
  5. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  6. throw new NumberFormatException();
  7. }
  8. int n = c - '0';
  9. while (--len > 0) {
  10. if (!isDigit(c = b[off++])) {
  11. throw new NumberFormatException();
  12. }
  13. n = n * 10 + c - '0';
  14. }
  15. return n;
  16. }

代码示例来源:origin: org.jboss.web/jbossweb

  1. public static int parseInt(char[] b, int off, int len)
  2. throws NumberFormatException
  3. {
  4. int c;
  5. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  6. throw new NumberFormatException();
  7. }
  8. int n = c - '0';
  9. while (--len > 0) {
  10. if (!isDigit(c = b[off++])) {
  11. throw new NumberFormatException();
  12. }
  13. n = n * 10 + c - '0';
  14. }
  15. return n;
  16. }

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

  1. public static int parseInt(char[] b, int off, int len)
  2. throws NumberFormatException
  3. {
  4. int c;
  5. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  6. throw new NumberFormatException();
  7. }
  8. int n = c - '0';
  9. while (--len > 0) {
  10. if (!isDigit(c = b[off++])) {
  11. throw new NumberFormatException();
  12. }
  13. n = n * 10 + c - '0';
  14. }
  15. return n;
  16. }

代码示例来源:origin: org.jboss.web/jbossweb

  1. /**
  2. * Parses an unsigned integer from the specified subarray of bytes.
  3. * @param b the bytes to parse
  4. * @param off the start offset of the bytes
  5. * @param len the length of the bytes
  6. * @exception NumberFormatException if the integer format was invalid
  7. */
  8. public static int parseInt(byte[] b, int off, int len)
  9. throws NumberFormatException
  10. {
  11. int c;
  12. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  13. throw new NumberFormatException();
  14. }
  15. int n = c - '0';
  16. while (--len > 0) {
  17. if (!isDigit(c = b[off++])) {
  18. throw new NumberFormatException();
  19. }
  20. n = n * 10 + c - '0';
  21. }
  22. return n;
  23. }

代码示例来源:origin: org.apache.coyote.springsource/com.springsource.org.apache.coyote.springsource

  1. /**
  2. * Parses an unsigned integer from the specified subarray of bytes.
  3. * @param b the bytes to parse
  4. * @param off the start offset of the bytes
  5. * @param len the length of the bytes
  6. * @exception NumberFormatException if the integer format was invalid
  7. */
  8. public static int parseInt(byte[] b, int off, int len)
  9. throws NumberFormatException
  10. {
  11. int c;
  12. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  13. throw new NumberFormatException();
  14. }
  15. int n = c - '0';
  16. while (--len > 0) {
  17. if (!isDigit(c = b[off++])) {
  18. throw new NumberFormatException();
  19. }
  20. n = n * 10 + c - '0';
  21. }
  22. return n;
  23. }

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

  1. /**
  2. * Parses an unsigned integer from the specified subarray of bytes.
  3. * @param b the bytes to parse
  4. * @param off the start offset of the bytes
  5. * @param len the length of the bytes
  6. * @exception NumberFormatException if the integer format was invalid
  7. */
  8. public static int parseInt(byte[] b, int off, int len)
  9. throws NumberFormatException
  10. {
  11. int c;
  12. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  13. throw new NumberFormatException();
  14. }
  15. int n = c - '0';
  16. while (--len > 0) {
  17. if (!isDigit(c = b[off++])) {
  18. throw new NumberFormatException();
  19. }
  20. n = n * 10 + c - '0';
  21. }
  22. return n;
  23. }

代码示例来源:origin: jboss.web/jbossweb

  1. /**
  2. * Parses an unsigned integer from the specified subarray of bytes.
  3. * @param b the bytes to parse
  4. * @param off the start offset of the bytes
  5. * @param len the length of the bytes
  6. * @exception NumberFormatException if the integer format was invalid
  7. */
  8. public static int parseInt(byte[] b, int off, int len)
  9. throws NumberFormatException
  10. {
  11. int c;
  12. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  13. throw new NumberFormatException();
  14. }
  15. int n = c - '0';
  16. while (--len > 0) {
  17. if (!isDigit(c = b[off++])) {
  18. throw new NumberFormatException();
  19. }
  20. n = n * 10 + c - '0';
  21. }
  22. return n;
  23. }

代码示例来源:origin: org.apache.coyote/com.springsource.org.apache.coyote

  1. /**
  2. * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards.
  3. */
  4. @Deprecated
  5. public static int parseInt(char[] b, int off, int len)
  6. throws NumberFormatException
  7. {
  8. int c;
  9. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  10. throw new NumberFormatException();
  11. }
  12. int n = c - '0';
  13. while (--len > 0) {
  14. if (!isDigit(c = b[off++])) {
  15. throw new NumberFormatException();
  16. }
  17. n = n * 10 + c - '0';
  18. }
  19. return n;
  20. }

代码示例来源:origin: org.jboss.web/jbossweb

  1. /**
  2. * Parses an unsigned long from the specified subarray of bytes.
  3. * @param b the bytes to parse
  4. * @param off the start offset of the bytes
  5. * @param len the length of the bytes
  6. * @exception NumberFormatException if the long format was invalid
  7. */
  8. public static long parseLong(byte[] b, int off, int len)
  9. throws NumberFormatException {
  10. int c;
  11. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  12. throw new NumberFormatException();
  13. }
  14. long n = c - '0';
  15. while (--len > 0) {
  16. if (isDigit(c = b[off++])
  17. && (n < OVERFLOW_LIMIT || (n == OVERFLOW_LIMIT && (c - '0') < 8))) {
  18. n = n * 10 + c - '0';
  19. } else {
  20. throw new NumberFormatException();
  21. }
  22. }
  23. return n;
  24. }

代码示例来源:origin: org.apache.geronimo.ext.tomcat/util

  1. /**
  2. * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards.
  3. */
  4. @Deprecated
  5. public static int parseInt(char[] b, int off, int len)
  6. throws NumberFormatException
  7. {
  8. int c;
  9. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  10. throw new NumberFormatException();
  11. }
  12. int n = c - '0';
  13. while (--len > 0) {
  14. if (!isDigit(c = b[off++])) {
  15. throw new NumberFormatException();
  16. }
  17. n = n * 10 + c - '0';
  18. }
  19. return n;
  20. }

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

  1. /**
  2. * Parses an unsigned long from the specified subarray of bytes.
  3. * @param b the bytes to parse
  4. * @param off the start offset of the bytes
  5. * @param len the length of the bytes
  6. * @return the long value
  7. * @exception NumberFormatException if the long format was invalid
  8. */
  9. public static long parseLong(byte[] b, int off, int len)
  10. throws NumberFormatException
  11. {
  12. int c;
  13. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  14. throw new NumberFormatException();
  15. }
  16. long n = c - '0';
  17. while (--len > 0) {
  18. if (isDigit(c = b[off++]) &&
  19. (n < OVERFLOW_LIMIT || (n == OVERFLOW_LIMIT && (c - '0') < 8))) {
  20. n = n * 10 + c - '0';
  21. } else {
  22. throw new NumberFormatException();
  23. }
  24. }
  25. return n;
  26. }
  27. }

代码示例来源:origin: org.jboss.web/jbossweb

  1. public static long parseLong(char[] b, int off, int len)
  2. throws NumberFormatException
  3. {
  4. int c;
  5. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  6. throw new NumberFormatException();
  7. }
  8. long n = c - '0';
  9. long m;
  10. while (--len > 0) {
  11. if (!isDigit(c = b[off++])) {
  12. throw new NumberFormatException();
  13. }
  14. m = n * 10 + c - '0';
  15. if (m < n) {
  16. // Overflow
  17. throw new NumberFormatException();
  18. } else {
  19. n = m;
  20. }
  21. }
  22. return n;
  23. }

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

  1. public static long parseLong(char[] b, int off, int len)
  2. throws NumberFormatException
  3. {
  4. int c;
  5. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  6. throw new NumberFormatException();
  7. }
  8. long n = c - '0';
  9. long m;
  10. while (--len > 0) {
  11. if (!isDigit(c = b[off++])) {
  12. throw new NumberFormatException();
  13. }
  14. m = n * 10 + c - '0';
  15. if (m < n) {
  16. // Overflow
  17. throw new NumberFormatException();
  18. } else {
  19. n = m;
  20. }
  21. }
  22. return n;
  23. }

代码示例来源:origin: jboss.web/jbossweb

  1. public static long parseLong(char[] b, int off, int len)
  2. throws NumberFormatException
  3. {
  4. int c;
  5. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  6. throw new NumberFormatException();
  7. }
  8. long n = c - '0';
  9. long m;
  10. while (--len > 0) {
  11. if (!isDigit(c = b[off++])) {
  12. throw new NumberFormatException();
  13. }
  14. m = n * 10 + c - '0';
  15. if (m < n) {
  16. // Overflow
  17. throw new NumberFormatException();
  18. } else {
  19. n = m;
  20. }
  21. }
  22. return n;
  23. }

代码示例来源:origin: org.apache.coyote.springsource/com.springsource.org.apache.coyote.springsource

  1. public static long parseLong(char[] b, int off, int len)
  2. throws NumberFormatException
  3. {
  4. int c;
  5. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  6. throw new NumberFormatException();
  7. }
  8. long n = c - '0';
  9. long m;
  10. while (--len > 0) {
  11. if (!isDigit(c = b[off++])) {
  12. throw new NumberFormatException();
  13. }
  14. m = n * 10 + c - '0';
  15. if (m < n) {
  16. // Overflow
  17. throw new NumberFormatException();
  18. } else {
  19. n = m;
  20. }
  21. }
  22. return n;
  23. }

代码示例来源:origin: org.apache.geronimo.ext.tomcat/util

  1. /**
  2. * Parses an unsigned integer from the specified subarray of bytes.
  3. * @param b the bytes to parse
  4. * @param off the start offset of the bytes
  5. * @param len the length of the bytes
  6. * @exception NumberFormatException if the integer format was invalid
  7. * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards.
  8. */
  9. @Deprecated
  10. public static int parseInt(byte[] b, int off, int len)
  11. throws NumberFormatException
  12. {
  13. int c;
  14. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  15. throw new NumberFormatException();
  16. }
  17. int n = c - '0';
  18. while (--len > 0) {
  19. if (!isDigit(c = b[off++])) {
  20. throw new NumberFormatException();
  21. }
  22. n = n * 10 + c - '0';
  23. }
  24. return n;
  25. }

代码示例来源:origin: org.apache.coyote/com.springsource.org.apache.coyote

  1. /**
  2. * Parses an unsigned integer from the specified subarray of bytes.
  3. * @param b the bytes to parse
  4. * @param off the start offset of the bytes
  5. * @param len the length of the bytes
  6. * @exception NumberFormatException if the integer format was invalid
  7. * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards.
  8. */
  9. @Deprecated
  10. public static int parseInt(byte[] b, int off, int len)
  11. throws NumberFormatException
  12. {
  13. int c;
  14. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  15. throw new NumberFormatException();
  16. }
  17. int n = c - '0';
  18. while (--len > 0) {
  19. if (!isDigit(c = b[off++])) {
  20. throw new NumberFormatException();
  21. }
  22. n = n * 10 + c - '0';
  23. }
  24. return n;
  25. }

代码示例来源:origin: org.apache.coyote/com.springsource.org.apache.coyote

  1. /**
  2. * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards.
  3. */
  4. @Deprecated
  5. public static long parseLong(char[] b, int off, int len)
  6. throws NumberFormatException
  7. {
  8. int c;
  9. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  10. throw new NumberFormatException();
  11. }
  12. long n = c - '0';
  13. long m;
  14. while (--len > 0) {
  15. if (!isDigit(c = b[off++])) {
  16. throw new NumberFormatException();
  17. }
  18. m = n * 10 + c - '0';
  19. if (m < n) {
  20. // Overflow
  21. throw new NumberFormatException();
  22. } else {
  23. n = m;
  24. }
  25. }
  26. return n;
  27. }

代码示例来源:origin: org.apache.geronimo.ext.tomcat/util

  1. /**
  2. * @deprecated Unused. Will be removed in Tomcat 8.0.x onwards.
  3. */
  4. @Deprecated
  5. public static long parseLong(char[] b, int off, int len)
  6. throws NumberFormatException
  7. {
  8. int c;
  9. if (b == null || len <= 0 || !isDigit(c = b[off++])) {
  10. throw new NumberFormatException();
  11. }
  12. long n = c - '0';
  13. long m;
  14. while (--len > 0) {
  15. if (!isDigit(c = b[off++])) {
  16. throw new NumberFormatException();
  17. }
  18. m = n * 10 + c - '0';
  19. if (m < n) {
  20. // Overflow
  21. throw new NumberFormatException();
  22. } else {
  23. n = m;
  24. }
  25. }
  26. return n;
  27. }

相关文章