Results 1 to 6 of 6
Thread: Limit of String
- 11-14-2007, 07:35 PM #1
Member
- Join Date
- Nov 2007
- Posts
- 97
- Rep Power
- 0
- 11-15-2007, 04:43 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Since Java used 16 bits unicode, 1 char = 2 bytes. So the string size would be Integer.MAX_VALUE. But I'm wired there, because available memory can cause on it. ;)
Actually you don't want to worried about the maximum length of a string. You always get a out of memory exception before you pass the maximum length of a string. :p
- 11-15-2007, 03:32 PM #3
Member
- Join Date
- Nov 2007
- Posts
- 97
- Rep Power
- 0
Thanks for your help.
Actually I am parsing a file and placing it into a String and want to know if it s a good idea to get it into String as OutOfMemory exception will create problems for me.
- 11-16-2007, 04:01 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
What kind of file it is. Can't you read line by line to your application, I hope a line wont be too long to give an exception on the length of a string.
- 11-16-2007, 11:59 AM #5
Member
- Join Date
- Nov 2007
- Posts
- 97
- Rep Power
- 0
Its a simple ASCII file but the lines are too big. I am not sure about the size but it varies with the file.
Surely, I am reading the file line by line in to String. Only thing that worries me is the line can be too much for the String. I might come up with an example to this.
Thanks.
- 11-19-2007, 04:48 AM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Actually you can do more other things on this. Read the specific length of a line to a string. Later you can merge them. But actually it is not that much easy. Because after merging the strings it should gives the exact output. You have think about a logic your self.:p
Similar Threads
-
Error: cannot resolve symbol' on Person (java.lang.String, java.lang.String)
By baltimore in forum New To JavaReplies: 2Last Post: 09-18-2008, 07:30 AM -
PM Inbox Limit Increased
By JavaBean in forum Suggestions & FeedbackReplies: 7Last Post: 01-17-2008, 08:48 PM -
Using java.util.Scanner to search for a String in a String
By Java Tip in forum Java TipReplies: 0Last Post: 11-20-2007, 04:59 PM -
Help with insertName(String name) and deleteName(String name)
By trill in forum New To JavaReplies: 1Last Post: 08-07-2007, 07:29 AM -
I can't seem to pass the value of a string variable into a string array
By mathias in forum Java AppletsReplies: 1Last Post: 08-03-2007, 10:52 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks