Package java.util

Examples of java.util.StringTokenizer.countTokens()


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


      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;
View Full Code Here

      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;
View Full Code Here

   private void getArchiveArray(String archiveList)
   {
      if (archiveList != null)
      {
         StringTokenizer st = new StringTokenizer(archiveList, ", ");
         archives = new String[st.countTokens()];

         for (int i = 0; i < archives.length; i++)
            archives[i] = st.nextToken();
      }
   }
View Full Code Here

    // tokenize setcookie request
    tokens = new StringTokenizer(cookieHeader,";");

    // there must be at least ONE token (name=value)
    if (tokens.countTokens() < 1) {
      throw new CookieException("Cookie contains no data");
    } else {
      String field = tokens.nextToken();
      int pos = field.indexOf('=');
      if (pos <= 0) {
View Full Code Here

      throw new CookieException("Not a Cookie header");
    }
   
    // tokenize setcookie request
    StringTokenizer tokens = new StringTokenizer(cookieHeader,";");
    Cookie[] cookies= new Cookie[tokens.countTokens()];
    int i=0;
   
    while (tokens.hasMoreTokens()) {
      cookies[i]=null;
        String field = tokens.nextToken();
View Full Code Here

   * context="/test/index.html"<br />
   * result="../images/test.gif"
   */
  private String localizePath(String path, String context) {
    StringTokenizer st = new StringTokenizer(context,"/");
    int depth = st.countTokens();
    if (! context.endsWith("/")) {
      depth--;
    }     

    StringBuffer sb = new StringBuffer();
View Full Code Here

    public static String[] split(String str, String delim) {
        if (str == null) {
            return new String[0];
        }
        StringTokenizer st = new StringTokenizer(str, delim);
        String[] s = new String[st.countTokens()];
        for (int i=0; i<s.length; i++) {
            s[i] = st.nextToken();
        }
        return s;
    }
View Full Code Here

            String line = reader.readLine();

            while (line != null) {
                StringTokenizer st = new StringTokenizer(line, ":");

                if (st.countTokens() > 1) {
                    users.put(st.nextToken(), st.nextToken());
                }

                line = reader.readLine();
            }
View Full Code Here

        strIndividualId = (String) request.getParameter("Individualid");
      }

      StringTokenizer st = new StringTokenizer(strIndividualId, ",");

      String[] strIndividuals = new String[st.countTokens()];
      int count = 0;

      while (st.hasMoreTokens())
      {
        strIndividuals[count] = st.nextToken();
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.