BufferedInputStream bin = new BufferedInputStream(new FileInputStream(file));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
bin.read(new byte[30]);//skip 30 bytes.
while(...)
{
  byte[] buf = new byte[1024];
  int j = bin.read(buf);
  bos.write(buf,0,j);
  if(j>xx) break;
}
...

解决方案 »

  1.   

    import java.io.*;public class jCOPY {
      public static void main(String args[]){
        try {
          jCOPY j = new jCOPY();
          j.CopyFile(new File(args[0]),new File(args[1]));
          }
        catch (Exception e) {
          e.printStackTrace();
          }
        }  public void CopyFile(File in, File out) throws Exception {
        FileInputStream fis  = new FileInputStream(in);
        FileOutputStream fos = new FileOutputStream(out);
        byte[] buf = new byte[1024];
        int i = 0;
        while((i=fis.read(buf))!=-1) {
          fos.write(buf, 0, i);
          }
        fis.close();
        fos.close();
        }
      }
      

  2.   

    用BufferedReader吧,有个readline方法能用上
      

  3.   

    import java.io.*;class FileCopy{}
      

  4.   

    import java.io.*;class FileCopy{    public static void main(String args[]) {
            try {
                RandomAccessFile filein = new RandomAccessFile("a.txt","r");
                FileOutputStream  fileout = new FileOutputStream("b.txt");
                int filePointer = 0;
                int fileLength = (int)filein.length();
                filein.read(new byte[30]);//skip 30 bytes.
                fileLength=fileLength - 60;
                
                //read from a.txt and write in b.txt
                byte[] buf = new byte[fileLength];
                int j = filein.read(buf);
                fileout.write(buf,0,j);
                
            }
            catch (Exception e) {
                String err = e.toString();
                System.out.println(err);
            }
        }
    }