public void copyHeader(InputStream in,OutputStream out) throws IOException {
  BufferedInputStream is=new BufferedInputStream(in);
  byte[] buf=new byte[64 * 1024];
  int bytesRead;
  while ((bytesRead=is.read(buf)) != -1) {
    out.write(buf,0,bytesRead);
  }
}

public void copyHeader ( InputStream in , OutputStream out ) throws IOException { BufferedInputStream is = new BufferedInputStream ( in ) ; byte [ ] buf = new byte [ 64 * 1024 ] ; int bytesRead ; while ( ( bytesRead = is . read ( buf ) ) != - 1 ) { out . write ( buf , 0 , bytesRead ) ; } }
copies the inputstream to the output stream , and keeps the output stream open .
