/** * Copies a range of characters into a new string. * @param start the offset of the first character (inclusive). * @param end The index to stop at (exclusive). * @return a new string containing the characters from start to the end of the string. * @throws IndexOutOfBoundsException if {@code start < 0} or {@code start > length()}. */ @Override public AsciiString subSequence(int start, int end) { return subSequence(start, end, true); }
/** * Copies a range of characters into a new string. * @param start the offset of the first character (inclusive). * @param end The index to stop at (exclusive). * @return a new string containing the characters from start to the end of the string. * @throws IndexOutOfBoundsException if {@code start < 0} or {@code start > length()}. */ @Override public AsciiString subSequence(int start, int end) { return subSequence(start, end, true); }
/** * Copies a range of characters into a new string. * @param start the offset of the first character (inclusive). * @param end The index to stop at (exclusive). * @return a new string containing the characters from start to the end of the string. * @throws IndexOutOfBoundsException if {@code start < 0} or {@code start > length()}. */ @Override public AsciiString subSequence(int start, int end) { return subSequence(start, end, true); }
/** * Copies a range of characters into a new string. * @param start the offset of the first character (inclusive). * @return a new string containing the characters from start to the end of the string. * @throws IndexOutOfBoundsException if {@code start < 0} or {@code start > length()}. */ public AsciiString subSequence(int start) { return subSequence(start, length()); }
/** * Copies a range of characters into a new string. * @param start the offset of the first character (inclusive). * @return a new string containing the characters from start to the end of the string. * @throws IndexOutOfBoundsException if {@code start < 0} or {@code start > length()}. */ public AsciiString subSequence(int start) { return subSequence(start, length()); }
public short parseShort(int start, int end, int radix) { int intValue = parseInt(start, end, radix); short result = (short) intValue; if (result != intValue) { throw new NumberFormatException(subSequence(start, end, false).toString()); } return result; }
private int parseInt(int start, int end, int radix, boolean negative) { int max = Integer.MIN_VALUE / radix; int result = 0; int currOffset = start; while (currOffset < end) { int digit = Character.digit((char) (value[currOffset++ + offset] & 0xFF), radix); if (digit == -1) { throw new NumberFormatException(subSequence(start, end, false).toString()); } if (max > result) { throw new NumberFormatException(subSequence(start, end, false).toString()); } int next = result * radix - digit; if (next > result) { throw new NumberFormatException(subSequence(start, end, false).toString()); } result = next; } if (!negative) { result = -result; if (result < 0) { throw new NumberFormatException(subSequence(start, end, false).toString()); } } return result; }
private long parseLong(int start, int end, int radix, boolean negative) { long max = Long.MIN_VALUE / radix; long result = 0; int currOffset = start; while (currOffset < end) { int digit = Character.digit((char) (value[currOffset++ + offset] & 0xFF), radix); if (digit == -1) { throw new NumberFormatException(subSequence(start, end, false).toString()); } if (max > result) { throw new NumberFormatException(subSequence(start, end, false).toString()); } long next = result * radix - digit; if (next > result) { throw new NumberFormatException(subSequence(start, end, false).toString()); } result = next; } if (!negative) { result = -result; if (result < 0) { throw new NumberFormatException(subSequence(start, end, false).toString()); } } return result; }
public int parseInt(int start, int end, int radix) { if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) { throw new NumberFormatException(); } if (start == end) { throw new NumberFormatException(); } int i = start; boolean negative = byteAt(i) == '-'; if (negative && ++i == end) { throw new NumberFormatException(subSequence(start, end, false).toString()); } return parseInt(i, end, radix, negative); }
/** * Copies a range of characters into a new string. * @param start the offset of the first character (inclusive). * @return a new string containing the characters from start to the end of the string. * @throws IndexOutOfBoundsException if {@code start < 0} or {@code start > length()}. */ public AsciiString subSequence(int start) { return subSequence(start, length()); }
public long parseLong(int start, int end, int radix) { if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) { throw new NumberFormatException(); } if (start == end) { throw new NumberFormatException(); } int i = start; boolean negative = byteAt(i) == '-'; if (negative && ++i == end) { throw new NumberFormatException(subSequence(start, end, false).toString()); } return parseLong(i, end, radix, negative); }
public short parseShort(int start, int end, int radix) { int intValue = parseInt(start, end, radix); short result = (short) intValue; if (result != intValue) { throw new NumberFormatException(subSequence(start, end, false).toString()); } return result; }
private int parseInt(int start, int end, int radix, boolean negative) { int max = Integer.MIN_VALUE / radix; int result = 0; int currOffset = start; while (currOffset < end) { int digit = Character.digit((char) (value[currOffset++ + offset] & 0xFF), radix); if (digit == -1) { throw new NumberFormatException(subSequence(start, end, false).toString()); } if (max > result) { throw new NumberFormatException(subSequence(start, end, false).toString()); } int next = result * radix - digit; if (next > result) { throw new NumberFormatException(subSequence(start, end, false).toString()); } result = next; } if (!negative) { result = -result; if (result < 0) { throw new NumberFormatException(subSequence(start, end, false).toString()); } } return result; }
private long parseLong(int start, int end, int radix, boolean negative) { long max = Long.MIN_VALUE / radix; long result = 0; int currOffset = start; while (currOffset < end) { int digit = Character.digit((char) (value[currOffset++ + offset] & 0xFF), radix); if (digit == -1) { throw new NumberFormatException(subSequence(start, end, false).toString()); } if (max > result) { throw new NumberFormatException(subSequence(start, end, false).toString()); } long next = result * radix - digit; if (next > result) { throw new NumberFormatException(subSequence(start, end, false).toString()); } result = next; } if (!negative) { result = -result; if (result < 0) { throw new NumberFormatException(subSequence(start, end, false).toString()); } } return result; }
public long parseLong(int start, int end, int radix) { if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) { throw new NumberFormatException(); } if (start == end) { throw new NumberFormatException(); } int i = start; boolean negative = byteAt(i) == '-'; if (negative && ++i == end) { throw new NumberFormatException(subSequence(start, end, false).toString()); } return parseLong(i, end, radix, negative); }
public int parseInt(int start, int end, int radix) { if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) { throw new NumberFormatException(); } if (start == end) { throw new NumberFormatException(); } int i = start; boolean negative = byteAt(i) == '-'; if (negative && ++i == end) { throw new NumberFormatException(subSequence(start, end, false).toString()); } return parseInt(i, end, radix, negative); }
private int parseInt(int start, int end, int radix, boolean negative) { int max = Integer.MIN_VALUE / radix; int result = 0; int currOffset = start; while (currOffset < end) { int digit = Character.digit((char) (value[currOffset++ + offset] & 0xFF), radix); if (digit == -1) { throw new NumberFormatException(subSequence(start, end, false).toString()); } if (max > result) { throw new NumberFormatException(subSequence(start, end, false).toString()); } int next = result * radix - digit; if (next > result) { throw new NumberFormatException(subSequence(start, end, false).toString()); } result = next; } if (!negative) { result = -result; if (result < 0) { throw new NumberFormatException(subSequence(start, end, false).toString()); } } return result; }
public short parseShort(int start, int end, int radix) { int intValue = parseInt(start, end, radix); short result = (short) intValue; if (result != intValue) { throw new NumberFormatException(subSequence(start, end, false).toString()); } return result; }
public long parseLong(int start, int end, int radix) { if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) { throw new NumberFormatException(); } if (start == end) { throw new NumberFormatException(); } int i = start; boolean negative = byteAt(i) == '-'; if (negative && ++i == end) { throw new NumberFormatException(subSequence(start, end, false).toString()); } return parseLong(i, end, radix, negative); }
public int parseInt(int start, int end, int radix) { if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) { throw new NumberFormatException(); } if (start == end) { throw new NumberFormatException(); } int i = start; boolean negative = byteAt(i) == '-'; if (negative && ++i == end) { throw new NumberFormatException(subSequence(start, end, false).toString()); } return parseInt(i, end, radix, negative); }