Return the fileSuffix or null if the url doesn't have a file suffix If the url is null then the file suffix will be null also
(URL url)
| 444 | * If the url is null then the file suffix will be null also |
| 445 | */ |
| 446 | @SuppressWarnings("unused") |
| 447 | private static String getFileSuffix(URL url){ |
| 448 | String fileName = null; |
| 449 | String fileSuffix = null; |
| 450 | |
| 451 | // GIGO test (garbage in garbage out) |
| 452 | if (url != null){ |
| 453 | // get the file name from the URL |
| 454 | fileName = url.getFile(); |
| 455 | |
| 456 | // tokenize this file name with "." as separator... |
| 457 | // the last token will be the file suffix |
| 458 | StringTokenizer st = new StringTokenizer(fileName,"."); |
| 459 | |
| 460 | // fileSuffix is the last token |
| 461 | while (st.hasMoreTokens()) |
| 462 | fileSuffix = st.nextToken(); |
| 463 | // here fileSuffix is the last token |
| 464 | } // End if |
| 465 | return fileSuffix; |
| 466 | }//getFileSufix |
| 467 | |
| 468 | /** |
| 469 | * Given a URL, this method returns all the 'file extensions' for the file |