View Single Post
  #1 (permalink)  
Old 12-08-2007, 10:32 AM
kaban kaban is offline
Member
 
Join Date: Dec 2007
Posts: 3
kaban is on a distinguished road
Help with Vectors and Strings...
Hey all,

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

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:

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?
Reply With Quote
Sponsored Links