| | |
| | | */ |
| | | public static StringBuilder readFile(String filePath, String charsetName) { |
| | | File file = new File(filePath); |
| | | StringBuilder fileContent = new StringBuilder(""); |
| | | StringBuilder fileContent = new StringBuilder(); |
| | | if (file == null || !file.isFile()) { |
| | | return null; |
| | | } |
| | |
| | | OutputStream o = null; |
| | | try { |
| | | o = new FileOutputStream(filePath); |
| | | byte data[] = new byte[1024]; |
| | | byte[] data = new byte[1024]; |
| | | int length = -1; |
| | | while ((length = stream.read(data)) != -1) { |
| | | o.write(data, 0, length); |
| | |
| | | } |
| | | |
| | | File folder = new File(folderName); |
| | | return (folder.exists() && folder.isDirectory()) ? true : folder.mkdirs(); |
| | | return (folder.exists() && folder.isDirectory()) || folder.mkdirs(); |
| | | } |
| | | |
| | | /** |