totalcross
totalcross copied to clipboard
Faster way to get file extensions
Issue Title
I would like to have a faster way to get file extensions
Describe the bug
Its too slow to get the files extensions.
To Reproduce
private String getImageExtension(String path) {
String[] extensoes = {".jpg", ".png", ".bmp", ".jpeg", ".gif",
".JPG", ".PNG", ".BMP", ".JPEG", ".GIF"};
byte[] xml = null;
for (int i = 0; i < extensoes.length; i++) {
xml = Vm.getFile(path + extensoes[i]);
if (xml != null) {
return path + extensoes[i];
}
}
return path;
}
Additional context
Using this code its taking too long i would like to know if there is a better way.