| | |
| | | package com.yeshi.buwan.util; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.FileOutputStream; |
| | | import java.io.FileReader; |
| | | import java.io.FileWriter; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.io.*; |
| | | import java.net.MalformedURLException; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | public static boolean appendSave(String content, String path) throws IOException { |
| | | File f = new File(path); |
| | | if (!f.exists()) |
| | | f.createNewFile(); |
| | | BufferedWriter out = null; |
| | | try { |
| | | out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(path), true))); |
| | | out.write(content); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | if (out != null) { |
| | | out.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | public static List<FileName> reNameFile(String dir, String path) { |
| | | if (dir.endsWith("/")) |
| | | dir = dir.substring(0, dir.length() - 1); |
| | |
| | | return f.getPath(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |