Examples of IsoTextCodingException


Examples of net.sf.isolation.text.IsoTextCodingException

  }

  public Object decode(IsoReader reader) throws IOException {
    char c = nextNonWhiteChar(reader);
    if (c != '[' && c != '{') {
      throw new IsoTextCodingException();
    } else {
      return decode(reader, c);
    }
  }
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

      switch (ch) {
      case '}':
        break;
      case ':':
        if (readingKey) {
          throw new IsoTextCodingException();
        }
        continue;
      case ',':
        if (map.isEmpty()) {
          throw new IsoTextCodingException();
        }
        continue;
      default:
        if (readingKey) {
          key = decode(reader, (char) ch);
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

      switch (ch) {
      case ']':
        break;
      case ',':
        if (list.isEmpty()) {
          throw new IsoTextCodingException();
        }
        ch = nextNonWhiteChar(reader);
        //$FALL-THROUGH$
      default:
        list.add(decode(reader, (char) ch));
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

  }

  public List<?> decode(IsoReader reader) throws IOException {
    int ch = reader.read();
    if (ch < 0) {
      throw new IsoTextCodingException();
    } else {
      return decode(reader, (char) ch);
    }
  }
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

          break;
        }
        c = (char) ch;
        continue;
      default:
        throw new IsoTextCodingException();
      }
      break;
    }
    return list;
  }
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

      }
      switch (ch) {
      case ',':
        ch = reader.read();
        if (ch < 0) {
          throw new IsoTextCodingException();
        }
        c = (char) ch;
        continue;
      default:
        reader.unread(ch);
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

    int i;
    int ch = c;
    for (i = 1; i < 4; i++) {
      ch = reader.read();
      if (ch < 0) {
        throw new IsoTextCodingException();
      }
      if (ch != IsoTextCodecConstants.NULL1.charAt(i)
          && ch != IsoTextCodecConstants.NULL2.charAt(i)) {
        throw new IsoTextCodingException();
      }
    }
    return null;
  }
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

    if (c == 't' || c == 'T') {
      int l = IsoTextCodecConstants.TRUE1.length();
      for (int i = 1; i < l; i++) {
        int ch = reader.read();
        if (ch < 0) {
          throw new IsoTextCodingException();
        }
        if (ch != IsoTextCodecConstants.TRUE1.charAt(i)
            && ch != IsoTextCodecConstants.TRUE2.charAt(i)) {
          throw new IsoTextCodingException();
        }
      }
      return Boolean.TRUE;
    } else {
      int l = IsoTextCodecConstants.FALSE1.length();
      for (int i = 1; i < l; i++) {
        int ch = reader.read();
        if (ch < 0) {
          throw new IsoTextCodingException();
        }
        if (ch != IsoTextCodecConstants.FALSE1.charAt(i)
            && ch != IsoTextCodecConstants.FALSE2.charAt(i)) {
          throw new IsoTextCodingException();
        }
      }
      return Boolean.FALSE;
    }
  }
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

    StringBuilder builder = new StringBuilder();
    builder.append(c);
    while (true) {
      int ch = reader.read();
      if (ch < 0) {
        throw new IsoTextCodingException();
      }
      switch (ch) {
      case '0':
      case '1':
      case '2':
      case '3':
      case '4':
      case '5':
      case '6':
      case '7':
      case '8':
      case '9':
      case '-':
      case '+':
      case 'e':
      case 'E':
      case '.':
        builder.append((char) ch);
        continue;
      default:
        reader.unread(ch);
        break;
      }
      break;
    }
    try {
      return new BigDecimal(builder.toString());
    } catch (NumberFormatException exception) {
      throw new IsoTextCodingException(builder.toString(), exception);
    }
  }
View Full Code Here

Examples of net.sf.isolation.text.IsoTextCodingException

  protected String decodeString(IsoReader reader, char c) throws IOException {
    StringBuilder builder = new StringBuilder();
    while (true) {
      int ch = reader.read();
      if (ch < 0) {
        throw new IsoTextCodingException();
      }
      if (ch == '"') {
        break;
      }
      c = (char) ch;
      if (c == '\\') {
        ch = reader.read();
        if (ch < 0) {
          throw new IsoTextCodingException();
        }
        switch (ch) {
        case '"':
        case '\\':
        case '/':
          break;
        case 'b':
          ch = '\b';
          break;
        case 'f':
          ch = '\f';
          break;
        case 'n':
          ch = '\n';
          break;
        case 'r':
          ch = '\r';
          break;
        case 't':
          ch = '\t';
          break;
        case 'u':
          char[] cbuf = new char[4];
          int count = reader.read(cbuf);
          if (count < 0) {
            throw new IsoTextCodingException();
          }
          if (count != cbuf.length) {
            throw new IsoTextCodingException();
          }
          try {
            long l = Long.parseLong(new String(cbuf), 16);
            if (l < 0) {
              throw new IsoTextCodingException();
            }
            ch = (char) l;
          } catch (NumberFormatException exception) {
            throw new IsoTextCodingException(exception);
          }
          break;
        default:
          throw new IsoTextCodingException();
        }
      }
      builder.append((char) ch);
    }
    return builder.toString();
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.