DataInOut 文件输入输出示例
public class DataInOutTest { public static void main(String[] args) { DataOutputStream dos=null; DataInputStream dis=null; FileInputStream fis=null; FileOutputStream fos=null; try{ fis = new FileInputStream("D:\\doc\\User.class"); dis = new DataInputStream(fis); fos =new FileOutputStream("D:\\doc\\newUser.class"); dos =new DataOutputStream(fos); int temp; while (((temp=dis.read())!=-1)){ fos.write(temp); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }finally { try{ if (dis!=null) dis.close();; if (fis!=null) fis.close(); if (fos!=null) fos.close(); if (dos!=null) dos.close(); } catch (IOException e) { e.printStackTrace(); } } } }