(String sourceFile)
| 2696 | /// |
| 2697 | /// - `IOException` |
| 2698 | public static String guessMimeType(String sourceFile) throws IOException { |
| 2699 | InputStream inputStream = null; //NOPMD CloseResource |
| 2700 | try { |
| 2701 | if (sourceFile.indexOf('/') > -1) { |
| 2702 | inputStream = FileSystemStorage.getInstance().openInputStream(sourceFile); |
| 2703 | } else { |
| 2704 | // Storage is a flat file system |
| 2705 | inputStream = Storage.getInstance().createInputStream(sourceFile); |
| 2706 | } |
| 2707 | return guessMimeType(inputStream); |
| 2708 | } finally { |
| 2709 | Util.cleanup(inputStream); |
| 2710 | } |
| 2711 | } |
| 2712 | |
| 2713 | /// Tries to determine the mime type of an InputStream based on its first |
| 2714 | /// bytes.Direct inspection of the bytes to determine the content type is |
no test coverage detected