Package java.util

Examples of java.util.StringTokenizer


     * @param line
     * @return
     */
    static List parseLine(String line) {
        List row = new ArrayList();
        StringTokenizer rowToken = new StringTokenizer(line,","); //$NON-NLS-1$
        for(int i=0; rowToken.hasMoreTokens(); i++){
            String data = rowToken.nextToken();
            if(data.charAt(0) == '"') {
                data = data.substring(1, data.length()-1);
            }
           
            if(data.equals("N/A")) { //$NON-NLS-1$
View Full Code Here


    }
    return _publicationsTypes;
  }

  public void setPublicationTypes(String types) {
    StringTokenizer tokenizer = new StringTokenizer(types, ", ");
    while (tokenizer.hasMoreTokens()) {
      _publicationsTypes.add(tokenizer.nextToken());
    }
  }
View Full Code Here

 
      if (path.indexOf(".") < 0) {
      return null;
      }
 
      StringTokenizer st = new StringTokenizer(path,".");
      while (st.hasMoreTokens()) {
      ext = st.nextToken();
      }
      // no extension if ext contains a "/"
      if (ext.indexOf("/") >= 0) {
      return null;
      }
View Full Code Here

  public static Hashtable sortClassesByRoot(String classes) {
    Hashtable                 roots;
    Hashtable                 result;
    Enumeration               enm;
    int                       i;
    StringTokenizer           tok;
    String                    clsname;
    Vector                    list;
    HierarchyPropertyParser   hpp;
    String                    separator;
    String                    root;
    String                    tmpStr;
   
    if (classes == null)
      return null;
   
    roots     = new Hashtable();
    hpp       = new HierarchyPropertyParser();
    separator = hpp.getSeperator();
   
    // go over all classnames and store them in the hashtable, with the
    // root element as the key
    tok   = new StringTokenizer(classes, ", ");
    while (tok.hasMoreElements()) {
      clsname = tok.nextToken();
      root    = getRootFromClass(clsname, separator);
      if (root == null)
        continue;
     
      // already stored?
View Full Code Here

    // existing MD5 keys become invalid
    removeHeader(HttpHeader.CONTENT_MD5);
  }
 
  public void setHttpCode(String httpCode) {
    StringTokenizer st = new StringTokenizer(httpCode," ");
    // an HTTP answer must have at least 2 fields
    if (st.countTokens() < 2) {
      return;
    }
  
    st.nextToken();
    String codeStr = st.nextToken();
   
    try {
      httpReturnCode = Integer.parseInt(codeStr);
    } catch (NumberFormatException e) {
      // something is wrong !!!
View Full Code Here

      lineno++;

      if ((line != null) &&
          (! line.trim().equals("")) &&
          (! line.startsWith("#"))) {
        StringTokenizer st = new StringTokenizer(line);
        // did we get 2 tokens ?
        if (st.countTokens() != 2) {
          throw new IOException("line "+lineno+" don't consists of 2 fields");
        }

        String allowStr = st.nextToken();
        boolean allow = true;
        String expression = st.nextToken();

        // allow or deny ?
        if (allowStr.equalsIgnoreCase("allow")) {
          allow=true;
        } else if (allowStr.equalsIgnoreCase("deny")) {
View Full Code Here

      lineno++;

      if ((line != null) &&
    (! line.trim().equals("")) &&
    (! line.startsWith("#"))) {
  StringTokenizer st = new StringTokenizer(line);
  // we need at least 2 tokens
  if (st.countTokens() < 2) {
    throw new IOException("line "+lineno+" has less then 2 fields");
  }

  String allowStr = st.nextToken();
  boolean allow = true;
  String mime = st.nextToken();

  // allow or deny ?
  if (allowStr.equalsIgnoreCase("allow")) {
    allow=true;
  } else if (allowStr.equalsIgnoreCase("deny")) {
    allow=false;
  } else {
    throw new IOException("first token in line "+lineno+
        " has to be allow or deny");
  }
   
 
  DownloadRule r = new DownloadRule();
  r.setAllow(allow);
  try {
    r.setMimeType(mime);
  } catch (IllegalArgumentException e) {
    throw new IOException(e.getMessage());
  }
 

  // parse < and > rules
  while (st.hasMoreTokens()) {
    boolean isMin=true;

    String descr=st.nextToken();
   
    if (descr.startsWith("<")) {
      // it is a maximum value
      isMin=false;
    } else if (descr.startsWith(">")) {
View Full Code Here

   
    // modified Dominic Betts 28/5/02
    // mimetype like:
    // Content-Type: text/html; Charset=iso-8859-1
    if (mimeType.indexOf(";") > 0) {
        StringTokenizer st = new StringTokenizer(mimeType, ";");
        mimeType = st.nextToken();
    }

    String basetype = null;
    String subtype = null;
    StringTokenizer st = new StringTokenizer(mimeType,"/");
    basetype = st.nextToken();
    subtype = st.nextToken();

    for (int i=0; i<rules.size(); i++) {
      DownloadRule rule = (DownloadRule)rules.elementAt(i);
      if (rule.matches(basetype,subtype,size)) {
  return rule;
View Full Code Here

        iRandomSelection = properties.getPropertyBoolean("HillClimber.Random", iRandomSelection);
        iUpdatePoints = properties.getPropertyBoolean("HillClimber.Update", iUpdatePoints);
        String neighbours = properties.getProperty("HillClimber.Neighbours",
                ItcSwapMove.class.getName()+"@1;"+
                ItcNotConflictingMove.class.getName()+"@1");
        for (StringTokenizer s=new StringTokenizer(neighbours,";");s.hasMoreTokens();) {
            String nsClassName = s.nextToken();
            double bonus = 1.0;
            if (nsClassName.indexOf('@')>=0) {
                bonus = Double.parseDouble(nsClassName.substring(nsClassName.indexOf('@')+1));
                nsClassName = nsClassName.substring(0, nsClassName.indexOf('@'));
            }
View Full Code Here

          parameters = urlString.substring(questionMark+1,restPosition);
          rest = urlString.substring(restPosition);
        }
         
        StringBuffer filteredUrl = new StringBuffer(urlString.substring(0,questionMark));
        StringTokenizer tokenizer = new StringTokenizer(parameters, "&");
        String and = "?";
        boolean changed = false;
        while (tokenizer.hasMoreTokens()) {
          String token = tokenizer.nextToken();
          boolean keep = true;
          for (int w=0; w<wasteParameters.size(); w++) {
            String wasteParameter = (String) wasteParameters.elementAt(w);
            if (token.startsWith(wasteParameter + "=")) {
              keep = false;
View Full Code Here

TOP

Related Classes of java.util.StringTokenizer

Copyright © 2015 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.