java读取二进制文件流

package LearnJave.First;
import java.io.*;

public class ReadVideo {
	
	public static void main(String[] args) throws IOException {
		File file = new File("D://1.mp4");
		InputStream in = null;
        byte[] tempbytes = new byte[100];
        int byteread = 0;
        in = new FileInputStream(file);
        
        DataOutputStream out = new DataOutputStream(new FileOutputStream(new File("D://2.mp4"))); 
        while ((byteread = in.read(tempbytes)) != -1) {
//            System.out.write(tempbytes, 0, byteread);
            out.write(tempbytes);
        }
	}
}

你可能感兴趣的:(java读取二进制文件流)