The copy and cut functions of files are simple, and the copy and cut functions are implemented.
The copy and cut methods of personal files are a rare little ape. What are the disadvantages?
/***** @ Param tarPath copy the file to that path * @ param sourcePath copy file path * @ throws IOException * // public void copyFile (String tarPath, string sourcePath) throws IOException {File tarFile = new File (tarPath); if (! TarFile. exists () {tarFile. createNewFile ();} File sourceFile = new File (sourcePath); try {// create a File input stream FileInputStream FS = new FileInputStream (sourceFile ); // input stream buffer BufferedInputStream bis = new BufferedInputStream (FCM); byte [] buffer = new byte [bis. available ()]; bis. read (buffer); bis. close (); FCM. close (); // create a file output stream FileOutputStream fos = new FileOutputStream (tarFile); BufferedOutputStream bos = new BufferedOutputStream (fos); // write data to the output stream bos. write (buffer); // refresh bos here. flush (); bos. close ();} catch (FileNotFoundException e) {// TODO Auto-generated catch block e. printStackTrace ();} catch (IOException e) {// TODO Auto-generated catch block e. printStackTrace () ;}// delete a file (you can also cut the file after copying it) /***** @ param sourcePath path of the File to be deleted */public void deleteFile (String sourcePath) {File tarFile = new File (sourcePath); if (tarFile. isFile () tarFile. delete ();}