1. Requirements: Copy the D:\\english.mp4 to the current project directory Copy.mp4
code example:
1 Packagecom.himi.filecopy;2 3 ImportJava.io.FileInputStream;4 ImportJava.io.FileOutputStream;5 Importjava.io.IOException;6 7 /**8 * 9 * Requirements: Copy the D:\\english.mp4 to the current project directory Copy.mp4Ten * One */ A Public classCOPYMP4 { - - Public Static voidMain (string[] args)throwsIOException { the //Data Source -FileInputStream FIS =NewFileInputStream ("D:\\english.mp4"); - //Destination -FileOutputStream fos =NewFileOutputStream ("Copy.mp4"); + - //Copying Data + intby = 0; A while((By=fis.read ())! =-1) { at Fos.write (by); - } - - //Freeing Resources - fos.close (); - fis.close (); in - } to +}
Run the effect as follows:
Java Fundamentals Hardening IO stream Note 26:fileinputstream/fileoutputstream copy MP4 video case