Package xnap.util

Examples of xnap.util.QuotedStringTokenizer


    {
  super(type);

  this.data = data;

  QuotedStringTokenizer t = new QuotedStringTokenizer(data);

  if (t.countTokens() < argc) {
      throw new InvalidMessageException("Wrong number of arguments.");
  }

  try {
      parse(t);
View Full Code Here


  if (j < 0) {
      throw new IOException("Invalid request");
  }
  String response = new String(data, 0, j);
     
  QuotedStringTokenizer t = new QuotedStringTokenizer(response);

  if (t.countTokens() < 3) {
      throw new IOException("Invalid request: " + response);
  }

  nick = t.nextToken();
  requestFilename = t.nextToken();

  try {
      offset = Long.parseLong(t.nextToken());
  }
  catch (NumberFormatException e) {
      throw new IOException("Invalid request");
  }   
    }
View Full Code Here

  byte data[] = new byte[2048];
  int i = in.read(data);
  if (i > 0) {
      String response = new String(data, 0, i);
       
      QuotedStringTokenizer t = new QuotedStringTokenizer(response);
       
      if (t.countTokens() < 3) {
    throw new IOException("invalid request: " + response);
      }

      nick = t.nextToken();
      filename = t.nextToken();
      try {
    filesize = Long.parseLong(t.nextToken());
      }
      catch (NumberFormatException e) {
    throw new IOException("invalid request: " + response);
      }
View Full Code Here

    public Server readServer() throws IOException {
  String line;

  while ((line = getIn().readLine()) != null) {
      try {
    QuotedStringTokenizer t
        = new QuotedStringTokenizer(line, " :");
   
    if (t.countTokens() < 2) {
        continue;
    }
       
    String ip = t.nextToken();
    int port = Integer.parseInt(t.nextToken());
    if (port < PortRange.MIN_PORT || port > PortRange.MAX_PORT) {
        throw new NumberFormatException();
    }

        String network = (t.countTokens() > 0) ? t.nextToken() : "";

        Server s = new Server(ip, port, network);

        if (t.countTokens() >= 3) {
          String token = t.nextToken();
          s.setUsername((token.length() > 0) ? token : null);
          token = t.nextToken();
          s.setPassword((token.length() > 0) ? token : null);
          token = t.nextToken();
          s.setEmail((token.length() > 0) ? token : null);
        }
         
        if (t.countTokens() >= 1) {
          s.setRedirector(t.nextToken().equals("true"));
        }
         
        if (t.countTokens() >= 1) {
          t.nextToken(); //s.setAutoJoinChannels();
        }

    return s;
      }
      catch (NumberFormatException e) {
View Full Code Here

    u.setCategory(XNap.tr("Banned"));
    UserManager.getInstance().add(u);
      }
      removeProperty("bannedUsers");

      QuotedStringTokenizer t
    = new QuotedStringTokenizer(get("hotlistUsers"));
      while (t.hasMoreTokens()) {
    GlobalUser u = new GlobalUser(t.nextToken(), false);
    UserManager.getInstance().add(u);
      }
      UserManager.getInstance().write();
      removeProperty("hotlistUsers");
  }
View Full Code Here

    public static Process exec(String command, File[] files)
  throws IOException
    {
  boolean inserted = false;
  QuotedStringTokenizer t = new QuotedStringTokenizer(command);
  ArrayList args = new ArrayList(t.countTokens() + files.length);
  while (t.hasMoreTokens()) {
      String s = t.nextToken();
      if (s.equals("{}")) {
    insertFiles(args, files);
    inserted = true;
      }
      else {
View Full Code Here

TOP

Related Classes of xnap.util.QuotedStringTokenizer

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.