Package net.sf.isolation.text

Examples of net.sf.isolation.text.IsoTextCodingException


  }

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


      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

      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

  }

  public Object decode(Reader reader) throws IOException {
    int ch = reader.read();
    if (ch < 0) {
      throw new IsoTextCodingException();
    } else {
      return decode(new PushbackReader(reader, 1), (char) ch);
    }
  }
View Full Code Here

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

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

    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)) {
        break;
      }
    }
    if (i != 4) {
      throw new IsoTextCodingException();
    }
    return null;
  }
View Full Code Here

    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)) {
          break;
        }
      }
      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)) {
          break;
        }
View Full Code Here

    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

  protected String decodeString(Reader 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

Related Classes of net.sf.isolation.text.IsoTextCodingException

Copyright © 2018 www.massapicom. 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.