可以的,(我试了一下,速度比较慢),这两个类一般用来操作基本类型的数据
- import java.io.DataInputStream;
- import java.io.DataOutputStream;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.FileOutputStream;
- import java.io.OutputStream;
- public class DataDemo {
- /**
- * @param args
- * @throws Exception
- */
- public static void main(String[] args) throws Exception {
- // TODO Auto-generated method stub
- DataInputStream dis=new DataInputStream(new FileInputStream("a.mp3"));
- DataOutputStream dos=new DataOutputStream(new FileOutputStream("b.mp3"));
- int data=-1;
- while((data=dis.read())!=-1)
- {
- dos.write(data);
-
- }
- dis.close();
- dos.close();
- }
- }
复制代码 |