Results 1 to 3 of 3
  1. #1
    kaban is offline Member
    Join Date
    Dec 2007
    Posts
    3
    Rep Power
    0

    Default Help with Vectors and Strings...

    Hey all,

    I am having problems with getting proper size Strings from a Vector. I have this function:

    Java Code:
    	public static String HandleUsername(Vector name, Vector address, Vector port, DatagramPacket user)
    	{
    		InetAddress a = user.getAddress();
    		String p = Integer.toString(user.getPort());
    
    		for (int i = 0; i < name.size(); i++)
    		{
    			if (address.elementAt(i).toString().equals(a.toString()) == true && 
    				port.elementAt(i).toString().equals(p) == true)
    			{
    				return (String)name.elementAt(i);
    			}
    		}
    
    		return "/fail";
    	}
    If I do a function call:

    Java Code:
    String s = HandleUsername(name, address, port, user)
    The size of that string s is always 65504 if I use s.length(). Why does this happen? Basically when I try pull the String from a Vector it gives me a max size (I think?) String. How do I get the actual size of the String?

  2. #2
    kaban is offline Member
    Join Date
    Dec 2007
    Posts
    3
    Rep Power
    0

    Default

    Any ideas?

  3. #3
    kaban is offline Member
    Join Date
    Dec 2007
    Posts
    3
    Rep Power
    0

    Default

    I have figured it out. Was a problem with converting from byte array to a String.

Similar Threads

  1. Vectors of Vectors or hash-somethings?
    By mindwarp in forum New To Java
    Replies: 3
    Last Post: 03-10-2008, 02:57 PM
  2. Can't access two vectors independantly?
    By splinter64uk in forum New To Java
    Replies: 2
    Last Post: 11-28-2007, 11:57 PM
  3. Vectors vs ArrayList
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-28-2007, 10:29 AM
  4. Understanding Vectors
    By cbrown08 in forum New To Java
    Replies: 7
    Last Post: 11-05-2007, 06:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •