<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ~~~ /* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; /** * * @author 海蘭 */ public class FileUtil { public static String[] getUtfLines(String path) throws IOException { byte[] filebyte=readFile(path); String filestr=new String(filebyte,"UTF-8"); String[] rev=filestr.split("\n"); return rev; } public static String[] getLines(String path) throws IOException { byte[] filebyte=readFile(path); String filestr=new String(filebyte,"GBK"); String[] rev=filestr.split("\n"); return rev; } /** * 讀文件 * * @param path * 文件名 * @return 文件內容 * @throws IOException */ public static byte[] readFile(String path) throws IOException { return readFile(path, 0); } /** * 讀文件 * * @param path * 文件名 * @param offset * 偏移位置 * @return 從偏移位置開始讀取的文件內容 * @throws IOException */ public static byte[] readFile(String path, long offset) throws IOException { return readFile(path, offset, -1); } /** * 讀文件 * * @param path * 文件名 * @param offset * 偏移位置 * @param size * 讀取大小 * @return 從偏移位置開始讀取size大小的文件內容 * @throws IOException */ public static byte[] readFile(String path, long offset, int size) throws IOException { InputStream is = null; try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); is = new FileInputStream(path); is.skip(offset); byte[] buff = new byte[4096]; int bufLength = -1; while ((bufLength = is.read(buff)) >= 0) { if (size > 0 && bufLength > size - baos.size()) { baos.write(buff, 0, size - baos.size()); break; } else { baos.write(buff, 0, bufLength); } } return baos.toByteArray(); } finally { if (is != null) { is.close(); } } } /** * 寫文件 * * @param path * 文件名 * @param content * 文件內容 * @return 服務端保存文件的實際絕對路徑 * @throws IOException */ public static String writeFile(String path, String content) throws IOException { byte[] matter=content.getBytes("GBK"); return writeFile(path, matter, false); } /** * 寫文件 * * @param path * 文件名 * @param content * 文件內容 * @param append * 追加方式 * @return 服務端保存文件的實際絕對路徑 * @throws IOException */ public static String writeFile(String path, String content,boolean append)throws IOException { byte[] matter=content.getBytes("GBK"); return writeFile(path, matter, append); } public static String writeToFile(String savePath, String content) { File f = new File(savePath); if (f.exists()) f.delete(); try { PrintStream ps = new PrintStream(savePath); String tmp[] = content.split("\n"); for (int i = 0; i < tmp.length; i++) ps.println(tmp[i]); } catch (Exception e) { e.printStackTrace(); } return ""; } /** * 寫文件 * * @param path * 文件名 * @param content * 文件內容 * @return 服務端保存文件的實際絕對路徑 * @throws IOException */ public static String writeFile(String path, byte[] content) throws IOException { return writeFile(path, content, false); } /** * 寫文件 * * @param path * 文件名 * @param content * 文件內容 * @param append * 追加方式 * @return 服務端保存文件的實際絕對路徑 * @throws IOException */ public static String writeFile(String path, byte[] content, boolean append) throws IOException { if (path == null || path.length() == 0) { path = File.createTempFile("writeServerFile", ".file") .getAbsolutePath(); } else { path = new File(path).getAbsolutePath(); } OutputStream os = null; try { os = new BufferedOutputStream(new FileOutputStream(path, append)); os.write(content); os.flush(); } finally { if (os != null) { os.close(); } } return path; } /** * 獲得該路徑下的所有文件名的列表 * @param Url * @return */ public static String[] getFileUrl(String Url) { File path = new File(Url); String[] list; list=path.list(); return list; } } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看