| 55 | } |
| 56 | |
| 57 | public static String readFile(String filePath) { |
| 58 | String result = ""; |
| 59 | try { |
| 60 | FileInputStream fileInputStream = new FileInputStream(filePath); |
| 61 | int length = fileInputStream.available(); |
| 62 | byte[] buffered = new byte[length]; |
| 63 | fileInputStream.read(buffered); |
| 64 | |
| 65 | result = new String(buffered, Charset.defaultCharset()); |
| 66 | |
| 67 | fileInputStream.close(); |
| 68 | } catch (Exception e) { |
| 69 | e.printStackTrace(); |
| 70 | } |
| 71 | return result; |
| 72 | |
| 73 | } |
| 74 | |
| 75 | public static String getFileName(String path) { |
| 76 | if (TextUtils.isEmpty(path)) return null; |