惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

AI
AI
TaoSecurity Blog
TaoSecurity Blog
H
Heimdal Security Blog
Help Net Security
Help Net Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Google DeepMind News
Google DeepMind News
爱范儿
爱范儿
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
N
News | PayPal Newsroom
V2EX - 技术
V2EX - 技术
博客园 - 【当耐特】
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Secure Thoughts
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
有赞技术团队
有赞技术团队
S
Schneier on Security
S
SegmentFault 最新的问题
Google Online Security Blog
Google Online Security Blog
H
Hacker News: Front Page
The Last Watchdog
The Last Watchdog
Schneier on Security
Schneier on Security
PCI Perspectives
PCI Perspectives
IT之家
IT之家
Project Zero
Project Zero
博客园 - 司徒正美
P
Privacy International News Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Jina AI
Jina AI
Security Latest
Security Latest
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
V
Vulnerabilities – Threatpost
W
WeLiveSecurity
NISL@THU
NISL@THU
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity

博客园 - Notus|南色的风

asp.net用url重写URLReWriter实现任意二级域名(续) selenium cant start a new browser(ie7):java.lang.StringIndexOutOfBoundsException: String index out of range: -1 修改sql server2005的系统时间 conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. eclipse输出jar的利器 java调用c#写的webservice java的Date.getTime()转换成C#的Datetime.ticks - Notus|南色的风 - 博客园 我的新博客 关于小凡 关于迷笛音乐节的重大通知-_- 给我一点自由...... 4月份的歌 都说了,一切都会过去 everything Will Flow Take It Away song2 【Ireland On-Line】霍利尔:裁判毁了枪手 【每日邮报】利物浦对阵阿森纳能走出牢狱要谢天谢地谢Peter Turn into
java移动/复制文件 copy/move file
Notus|南色的风 · 2008-08-06 · via 博客园 - Notus|南色的风

public class FileAccess
{

 public static boolean Move(File srcFile, String destPath)
 {
        // Destination directory
        File dir = new File(destPath);
      
        // Move file to new directory
        boolean success = srcFile.renameTo(new File(dir, srcFile.getName()));
      
        return success;
    }
 
 public static boolean Move(String srcFile, String destPath)
 {
        // File (or directory) to be moved
        File file = new File(srcFile);
      
        // Destination directory
        File dir = new File(destPath);
      
        // Move file to new directory
        boolean success = file.renameTo(new File(dir, file.getName()));
      
        return success;
    }
 
 public  static   void     Copy(String     oldPath,     String     newPath)   
   {   
          try     {   
                  int     bytesum     =     0;   
                  int     byteread     =     0;   
                  File     oldfile     =     new     File(oldPath);   
                  if     (oldfile.exists())     {     
                          InputStream     inStream     =     new     FileInputStream(oldPath);    
                          FileOutputStream     fs     =     new     FileOutputStream(newPath);   
                          byte[]     buffer     =     new     byte[1444];   
                          int     length;   
                          while     (     (byteread     =     inStream.read(buffer))     !=     -1)     {   
                                  bytesum     +=     byteread;       
                                  System.out.println(bytesum);   
                                  fs.write(buffer,     0,     byteread);   
                          }   
                          inStream.close();   
                  }   
          }   
          catch     (Exception     e)     {   
                  System.out.println( "error  ");   
                  e.printStackTrace();   
          }   
    }    
   public   static  void     Copy(File     oldfile,     String     newPath)   
   {   
          try     {   
                  int     bytesum     =     0;   
                  int     byteread     =     0;   
                  //File     oldfile     =     new     File(oldPath);   
                  if     (oldfile.exists())     {     
                          InputStream     inStream     =     new     FileInputStream(oldfile);    
                          FileOutputStream     fs     =     new     FileOutputStream(newPath);   
                          byte[]     buffer     =     new     byte[1444];   
                          while     (     (byteread     =     inStream.read(buffer))     !=     -1)     {   
                                  bytesum     +=     byteread;       
                                  System.out.println(bytesum);   
                                  fs.write(buffer,     0,     byteread);   
                          }   
                          inStream.close();   
                  }   
          }   
          catch     (Exception     e)     {   
                  System.out.println( "error  ");   
                  e.printStackTrace();   
          }   
    }    
}
在茫茫网海中收集的两个方法,如果是您的原创,请原谅我的盗用 :(