Examples of IsoTextCodingException


Examples of net.sf.isolation.text.IsoTextCodingException

  protected char nextNonWhiteChar(IsoReader reader) throws IOException {
    int c = -1;
    while (true) {
      c = reader.read();
      if (c < 0) {
        throw new IsoTextCodingException();
      }
      if (!Character.isWhitespace(c)) {
        break;
      }
    }
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

    if (length == IsoTextCodecConstants.TRUE1.length()) {
      int l = IsoTextCodecConstants.TRUE1.length();
      for (int i = 0; i < l; i++) {
        int ch = buffer[offset + i];
        if (ch < 0) {
          throw new IsoTextCodingException();
        }
        if (ch != IsoTextCodecConstants.TRUE1.charAt(i)
            && ch != IsoTextCodecConstants.TRUE2.charAt(i)) {
          throw new IsoTextCodingException();
        }
      }
      return Boolean.TRUE;
    } else {
      if (length == IsoTextCodecConstants.FALSE1.length()) {
        int l = IsoTextCodecConstants.FALSE1.length();
        for (int i = 0; i < l; i++) {
          int ch = buffer[offset + i];
          if (ch < 0) {
            throw new IsoTextCodingException();
          }
          if (ch != IsoTextCodecConstants.FALSE1.charAt(i)
              && ch != IsoTextCodecConstants.FALSE2.charAt(i)) {
            throw new IsoTextCodingException();
          }
        }
        return Boolean.FALSE;
      } else {
        throw new IsoTextCodingException();
      }
    }
  }
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

  }

  public byte getByte(char[] buffer, int offset, int length) {
    int temp = getInt(buffer, offset, length);
    if (temp < Byte.MIN_VALUE || temp > Byte.MAX_VALUE) {
      throw new IsoTextCodingException();
    }
    return (byte) temp;
  }
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

  }

  public short getShort(char[] buffer, int offset, int length) {
    int temp = getInt(buffer, offset, length);
    if (temp < Short.MIN_VALUE || temp > Short.MAX_VALUE) {
      throw new IsoTextCodingException();
    }
    return (short) temp;
  }
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

  }

  public int getInt(char[] buffer, int offset, int length) {
    if (buffer[offset] == '-') {
      if (length > MAX_INT_NEGATIVE_LENGTH) {
        throw new IsoTextCodingException();
      }
      return getInt(MAX_INT_NEGATIVE, LAST_INT_NEGATIVO, true, buffer,
          offset + 1, length - 1);
    } else {
      if (length > MAX_INT_POSITIVE_LENGTH) {
        throw new IsoTextCodingException();
      }
      return getInt(MAX_INT_POSITIVE, LAST_INT_POSITIVE, false, buffer,
          offset, length);
    }
  }
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

    for (int i = offset1; i < l; i++) {
      char c = buffer[i];
      if (c >= '0' && c <= '9') {
        result = (result * 10) + (c - '0');
      } else {
        throw new IsoTextCodingException(new String(new char[] { c }),
            null);
      }
    }
    char c = buffer[l];
    if (c >= '0'
        && ((result < limit && c <= '9') || (result == limit && c <= last))) {
      if (negative) {
        result = (result * -10) + ('0' - c);
      } else {
        result = (result * 10) + (c - '0');
      }
      return result;
    } else {
      throw new IsoTextCodingException("Overflow: "
          + new String(buffer, offset1, length1), null);
    }
  }
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

  }

  public long getLong(char[] buffer, int offset, int length) {
    if (buffer[offset] == '-') {
      if (length > MAX_LONG_NEGATIVE_LENGTH) {
        throw new IsoTextCodingException();
      }
      return getLong(MAX_LONG_NEGATIVE, LAST_LONG_NEGATIVO, true, buffer,
          offset + 1, length - 1);
    } else {
      if (length > MAX_LONG_POSITIVE_LENGTH) {
        throw new IsoTextCodingException();
      }
      return getLong(MAX_LONG_POSITIVE, LAST_LONG_POSITIVE, false,
          buffer, offset, length);
    }
  }
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

    for (int i = offset1; i < l; i++) {
      char c = buffer[i];
      if (c >= '0' && c <= '9') {
        result = (result * 10) + (c - '0');
      } else {
        throw new IsoTextCodingException(new String(new char[] { c }),
            null);
      }
    }
    char c = buffer[l];
    if (c >= '0'
        && ((result < limit && c <= '9') || (result == limit && c <= last))) {
      if (negative) {
        result = (result * -10) + ('0' - c);
      } else {
        result = (result * 10) + (c - '0');
      }
    } else {
      throw new IsoTextCodingException("Overflow: "
          + new String(buffer, offset1, length1), null);
    }
    return result;
  }
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

  public float getFloat(char[] buffer, int offset, int length) {
    String str = new String(buffer, offset, length);
    try {
      return Float.parseFloat(str);
    } catch (NumberFormatException e) {
      throw new IsoTextCodingException(str, e);
    }
  }
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

  public double getDouble(char[] buffer, int offset, int length) {
    String str = new String(buffer, offset, length);
    try {
      return Double.parseDouble(str);
    } catch (NumberFormatException e) {
      throw new IsoTextCodingException(str, e);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.