java.lang.String.failedBoundsCheck()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(12.4k)|赞(0)|评价(0)|浏览(178)

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

String.failedBoundsCheck介绍

暂无

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Initializes this string to contain the specified characters in the
 * character array. Modifying the character array after creating the string
 * has no effect on the string.
 *
 * @throws NullPointerException
 *             if {@code data == null}.
 * @throws IndexOutOfBoundsException
 *             if {@code charCount < 0 || offset < 0 || offset + charCount > data.length}
 */
public String(char[] data, int offset, int charCount) {
  if ((offset | charCount) < 0 || charCount > data.length - offset) {
    throw failedBoundsCheck(data.length, offset, charCount);
  }
  this.offset = 0;
  this.value = new char[charCount];
  this.count = charCount;
  System.arraycopy(data, offset, value, 0, count);
}

代码示例来源:origin: robovm/robovm

/**
 * Converts the byte array to a string, setting the high byte of every
 * character to {@code high}.
 *
 * @throws NullPointerException
 *             if {@code data == null}.
 * @throws IndexOutOfBoundsException
 *             if {@code byteCount < 0 || offset < 0 || offset + byteCount > data.length}
 *
 * @deprecated Use {@link #String(byte[], int, int)} instead.
 */
@Deprecated
public String(byte[] data, int high, int offset, int byteCount) {
  if ((offset | byteCount) < 0 || byteCount > data.length - offset) {
    throw failedBoundsCheck(data.length, offset, byteCount);
  }
  this.offset = 0;
  this.value = new char[byteCount];
  this.count = byteCount;
  high <<= 8;
  for (int i = 0; i < count; i++) {
    value[i] = (char) (high + (data[offset++] & 0xff));
  }
}

代码示例来源:origin: robovm/robovm

/**
 * Creates a {@code String} from the sub-array of Unicode code points.
 *
 * @throws NullPointerException
 *             if {@code codePoints == null}.
 * @throws IllegalArgumentException
 *             if any of the elements of {@code codePoints} are not valid
 *             Unicode code points.
 * @throws IndexOutOfBoundsException
 *             if {@code offset} or {@code count} are not within the bounds
 *             of {@code codePoints}.
 * @since 1.5
 */
public String(int[] codePoints, int offset, int count) {
  if (codePoints == null) {
    throw new NullPointerException("codePoints == null");
  }
  if ((offset | count) < 0 || count > codePoints.length - offset) {
    throw failedBoundsCheck(codePoints.length, offset, count);
  }
  this.offset = 0;
  this.value = new char[count * 2];
  int end = offset + count;
  int c = 0;
  for (int i = offset; i < end; i++) {
    c += Character.toChars(codePoints[i], this.value, c);
  }
  this.count = c;
}

代码示例来源:origin: robovm/robovm

throw failedBoundsCheck(data.length, index, end - start);

代码示例来源:origin: robovm/robovm

throw failedBoundsCheck(data.length, offset, byteCount);

代码示例来源:origin: ibinti/bugvm

/**
 * Initializes this string to contain the specified characters in the
 * character array. Modifying the character array after creating the string
 * has no effect on the string.
 *
 * @throws NullPointerException
 *             if {@code data == null}.
 * @throws IndexOutOfBoundsException
 *             if {@code charCount < 0 || offset < 0 || offset + charCount > data.length}
 */
public String(char[] data, int offset, int charCount) {
  if ((offset | charCount) < 0 || charCount > data.length - offset) {
    throw failedBoundsCheck(data.length, offset, charCount);
  }
  this.offset = 0;
  this.value = new char[charCount];
  this.count = charCount;
  System.arraycopy(data, offset, value, 0, count);
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Initializes this string to contain the specified characters in the
 * character array. Modifying the character array after creating the string
 * has no effect on the string.
 *
 * @throws NullPointerException
 *             if {@code data == null}.
 * @throws IndexOutOfBoundsException
 *             if {@code charCount < 0 || offset < 0 || offset + charCount > data.length}
 */
public String(char[] data, int offset, int charCount) {
  if ((offset | charCount) < 0 || charCount > data.length - offset) {
    throw failedBoundsCheck(data.length, offset, charCount);
  }
  this.offset = 0;
  this.value = new char[charCount];
  this.count = charCount;
  System.arraycopy(data, offset, value, 0, count);
}

代码示例来源:origin: MobiVM/robovm

/**
 * Initializes this string to contain the specified characters in the
 * character array. Modifying the character array after creating the string
 * has no effect on the string.
 *
 * @throws NullPointerException
 *             if {@code data == null}.
 * @throws IndexOutOfBoundsException
 *             if {@code charCount < 0 || offset < 0 || offset + charCount > data.length}
 */
public String(char[] data, int offset, int charCount) {
  if ((offset | charCount) < 0 || charCount > data.length - offset) {
    throw failedBoundsCheck(data.length, offset, charCount);
  }
  this.offset = 0;
  this.value = new char[charCount];
  this.count = charCount;
  System.arraycopy(data, offset, value, 0, count);
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Initializes this string to contain the specified characters in the
 * character array. Modifying the character array after creating the string
 * has no effect on the string.
 *
 * @throws NullPointerException
 *             if {@code data == null}.
 * @throws IndexOutOfBoundsException
 *             if {@code charCount < 0 || offset < 0 || offset + charCount > data.length}
 */
public String(char[] data, int offset, int charCount) {
  if ((offset | charCount) < 0 || charCount > data.length - offset) {
    throw failedBoundsCheck(data.length, offset, charCount);
  }
  this.offset = 0;
  this.value = new char[charCount];
  this.count = charCount;
  System.arraycopy(data, offset, value, 0, count);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Initializes this string to contain the specified characters in the
 * character array. Modifying the character array after creating the string
 * has no effect on the string.
 *
 * @throws NullPointerException
 *             if {@code data == null}.
 * @throws IndexOutOfBoundsException
 *             if {@code charCount < 0 || offset < 0 || offset + charCount > data.length}
 */
public String(char[] data, int offset, int charCount) {
  if ((offset | charCount) < 0 || charCount > data.length - offset) {
    throw failedBoundsCheck(data.length, offset, charCount);
  }
  this.offset = 0;
  this.value = new char[charCount];
  this.count = charCount;
  System.arraycopy(data, offset, value, 0, count);
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Initializes this string to contain the specified characters in the
 * character array. Modifying the character array after creating the string
 * has no effect on the string.
 *
 * @throws NullPointerException
 *             if {@code data == null}.
 * @throws IndexOutOfBoundsException
 *             if {@code charCount < 0 || offset < 0 || offset + charCount > data.length}
 */
public String(char[] data, int offset, int charCount) {
  if ((offset | charCount) < 0 || charCount > data.length - offset) {
    throw failedBoundsCheck(data.length, offset, charCount);
  }
  this.offset = 0;
  this.value = new char[charCount];
  this.count = charCount;
  System.arraycopy(data, offset, value, 0, count);
}

代码示例来源:origin: ibinti/bugvm

/**
 * Converts the byte array to a string, setting the high byte of every
 * character to {@code high}.
 *
 * @throws NullPointerException
 *             if {@code data == null}.
 * @throws IndexOutOfBoundsException
 *             if {@code byteCount < 0 || offset < 0 || offset + byteCount > data.length}
 *
 * @deprecated Use {@link #String(byte[], int, int)} instead.
 */
@Deprecated
public String(byte[] data, int high, int offset, int byteCount) {
  if ((offset | byteCount) < 0 || byteCount > data.length - offset) {
    throw failedBoundsCheck(data.length, offset, byteCount);
  }
  this.offset = 0;
  this.value = new char[byteCount];
  this.count = byteCount;
  high <<= 8;
  for (int i = 0; i < count; i++) {
    value[i] = (char) (high + (data[offset++] & 0xff));
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Converts the byte array to a string, setting the high byte of every
 * character to {@code high}.
 *
 * @throws NullPointerException
 *             if {@code data == null}.
 * @throws IndexOutOfBoundsException
 *             if {@code byteCount < 0 || offset < 0 || offset + byteCount > data.length}
 *
 * @deprecated Use {@link #String(byte[], int, int)} instead.
 */
@Deprecated
public String(byte[] data, int high, int offset, int byteCount) {
  if ((offset | byteCount) < 0 || byteCount > data.length - offset) {
    throw failedBoundsCheck(data.length, offset, byteCount);
  }
  this.offset = 0;
  this.value = new char[byteCount];
  this.count = byteCount;
  high <<= 8;
  for (int i = 0; i < count; i++) {
    value[i] = (char) (high + (data[offset++] & 0xff));
  }
}

代码示例来源:origin: MobiVM/robovm

/**
 * Converts the byte array to a string, setting the high byte of every
 * character to {@code high}.
 *
 * @throws NullPointerException
 *             if {@code data == null}.
 * @throws IndexOutOfBoundsException
 *             if {@code byteCount < 0 || offset < 0 || offset + byteCount > data.length}
 *
 * @deprecated Use {@link #String(byte[], int, int)} instead.
 */
@Deprecated
public String(byte[] data, int high, int offset, int byteCount) {
  if ((offset | byteCount) < 0 || byteCount > data.length - offset) {
    throw failedBoundsCheck(data.length, offset, byteCount);
  }
  this.offset = 0;
  this.value = new char[byteCount];
  this.count = byteCount;
  high <<= 8;
  for (int i = 0; i < count; i++) {
    value[i] = (char) (high + (data[offset++] & 0xff));
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Converts the byte array to a string, setting the high byte of every
 * character to {@code high}.
 *
 * @throws NullPointerException
 *             if {@code data == null}.
 * @throws IndexOutOfBoundsException
 *             if {@code byteCount < 0 || offset < 0 || offset + byteCount > data.length}
 *
 * @deprecated Use {@link #String(byte[], int, int)} instead.
 */
@Deprecated
public String(byte[] data, int high, int offset, int byteCount) {
  if ((offset | byteCount) < 0 || byteCount > data.length - offset) {
    throw failedBoundsCheck(data.length, offset, byteCount);
  }
  this.offset = 0;
  this.value = new char[byteCount];
  this.count = byteCount;
  high <<= 8;
  for (int i = 0; i < count; i++) {
    value[i] = (char) (high + (data[offset++] & 0xff));
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Converts the byte array to a string, setting the high byte of every
 * character to {@code high}.
 *
 * @throws NullPointerException
 *             if {@code data == null}.
 * @throws IndexOutOfBoundsException
 *             if {@code byteCount < 0 || offset < 0 || offset + byteCount > data.length}
 *
 * @deprecated Use {@link #String(byte[], int, int)} instead.
 */
@Deprecated
public String(byte[] data, int high, int offset, int byteCount) {
  if ((offset | byteCount) < 0 || byteCount > data.length - offset) {
    throw failedBoundsCheck(data.length, offset, byteCount);
  }
  this.offset = 0;
  this.value = new char[byteCount];
  this.count = byteCount;
  high <<= 8;
  for (int i = 0; i < count; i++) {
    value[i] = (char) (high + (data[offset++] & 0xff));
  }
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Converts the byte array to a string, setting the high byte of every
 * character to {@code high}.
 *
 * @throws NullPointerException
 *             if {@code data == null}.
 * @throws IndexOutOfBoundsException
 *             if {@code byteCount < 0 || offset < 0 || offset + byteCount > data.length}
 *
 * @deprecated Use {@link #String(byte[], int, int)} instead.
 */
@Deprecated
public String(byte[] data, int high, int offset, int byteCount) {
  if ((offset | byteCount) < 0 || byteCount > data.length - offset) {
    throw failedBoundsCheck(data.length, offset, byteCount);
  }
  this.offset = 0;
  this.value = new char[byteCount];
  this.count = byteCount;
  high <<= 8;
  for (int i = 0; i < count; i++) {
    value[i] = (char) (high + (data[offset++] & 0xff));
  }
}

代码示例来源:origin: MobiVM/robovm

/**
 * Creates a {@code String} from the sub-array of Unicode code points.
 *
 * @throws NullPointerException
 *             if {@code codePoints == null}.
 * @throws IllegalArgumentException
 *             if any of the elements of {@code codePoints} are not valid
 *             Unicode code points.
 * @throws IndexOutOfBoundsException
 *             if {@code offset} or {@code count} are not within the bounds
 *             of {@code codePoints}.
 * @since 1.5
 */
public String(int[] codePoints, int offset, int count) {
  if (codePoints == null) {
    throw new NullPointerException("codePoints == null");
  }
  if ((offset | count) < 0 || count > codePoints.length - offset) {
    throw failedBoundsCheck(codePoints.length, offset, count);
  }
  this.offset = 0;
  this.value = new char[count * 2];
  int end = offset + count;
  int c = 0;
  for (int i = offset; i < end; i++) {
    c += Character.toChars(codePoints[i], this.value, c);
  }
  this.count = c;
}

代码示例来源:origin: ibinti/bugvm

/**
 * Creates a {@code String} from the sub-array of Unicode code points.
 *
 * @throws NullPointerException
 *             if {@code codePoints == null}.
 * @throws IllegalArgumentException
 *             if any of the elements of {@code codePoints} are not valid
 *             Unicode code points.
 * @throws IndexOutOfBoundsException
 *             if {@code offset} or {@code count} are not within the bounds
 *             of {@code codePoints}.
 * @since 1.5
 */
public String(int[] codePoints, int offset, int count) {
  if (codePoints == null) {
    throw new NullPointerException("codePoints == null");
  }
  if ((offset | count) < 0 || count > codePoints.length - offset) {
    throw failedBoundsCheck(codePoints.length, offset, count);
  }
  this.offset = 0;
  this.value = new char[count * 2];
  int end = offset + count;
  int c = 0;
  for (int i = offset; i < end; i++) {
    c += Character.toChars(codePoints[i], this.value, c);
  }
  this.count = c;
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Creates a {@code String} from the sub-array of Unicode code points.
 *
 * @throws NullPointerException
 *             if {@code codePoints == null}.
 * @throws IllegalArgumentException
 *             if any of the elements of {@code codePoints} are not valid
 *             Unicode code points.
 * @throws IndexOutOfBoundsException
 *             if {@code offset} or {@code count} are not within the bounds
 *             of {@code codePoints}.
 * @since 1.5
 */
public String(int[] codePoints, int offset, int count) {
  if (codePoints == null) {
    throw new NullPointerException("codePoints == null");
  }
  if ((offset | count) < 0 || count > codePoints.length - offset) {
    throw failedBoundsCheck(codePoints.length, offset, count);
  }
  this.offset = 0;
  this.value = new char[count * 2];
  int end = offset + count;
  int c = 0;
  for (int i = offset; i < end; i++) {
    c += Character.toChars(codePoints[i], this.value, c);
  }
  this.count = c;
}

相关文章