Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException at Split()
I have a small program that works fine on most files.
But since I try to read this incredible huge tab sperated file it gives me after a while an java.lang.ArrayIndexOutOfBoundsException at an split function.
Can this also be becasue the file is too big and my computer here doesn't have enough memory?
Becasue when running this almost the max. in memory is used. (I do not have much memory on this computer I am now on...)
Becasue all the program realy does is reading the file and printed the split data to a new file. :S
Re: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException at Split()
means you are splitting a string object without having any data.
Example:-
String mainString = "";
String splitStringArray[] = mainString.split("some Character");
if you use statement like splitStringArray[0],splitStringArray[1],splitStringArray[2].....;
then you can get Exception like ArrayIndexOutOfBounds
Re: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException at Split()
Okey.
The problem also with this file is, it is so big that I can hardly open it so I can't look in it.
Is there maybe a way that I can say
if "" do don't split, else split().
Re: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException at Split()
The String class has methods you could use to test for empty
Or test the length of the array returned by split() to see if it has any elements (length > 0)
Re: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException at Split()
I will try that length item.
Thanks.