Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-08-2007, 09:32 AM
Member
 
Join Date: Dec 2007
Posts: 3
Rep Power: 0
kaban is on a distinguished road
Default 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?
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 12-09-2007, 02:40 AM
Member
 
Join Date: Dec 2007
Posts: 3
Rep Power: 0
kaban is on a distinguished road
Default
Any ideas?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 12-09-2007, 10:04 AM
Member
 
Join Date: Dec 2007
Posts: 3
Rep Power: 0
kaban is on a distinguished road
Default
I have figured it out. Was a problem with converting from byte array to a String.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vectors of Vectors or hash-somethings? mindwarp New To Java 3 03-10-2008 03:57 PM
Can't access two vectors independantly? splinter64uk New To Java 2 11-29-2007 12:57 AM
Vectors vs ArrayList Java Tip Java Tips 0 11-28-2007 11:29 AM
Understanding Vectors cbrown08 New To Java 7 11-05-2007 07:56 PM
Using Vectors in Java JavaForums Java Blogs 0 11-04-2007 08:31 PM


All times are GMT +2. The time now is 05:16 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org