Copy and rename file on different location
<p>I have one file  example.tar.gz and I need to copy to another location with different name 
example_test.tar.gz. I tried with</p>

<pre><code>private  void copyFile(File srcFile, File destFile) throws IOException 
    {
            InputStream oInStream = new FileInputStream(srcFile);
            OutputStream oOutStream = new FileOutputStream(destFile);

            // Transfer bytes from in to out
            byte[] oBytes = new byte[1024];
            int nLength;
            BufferedInputStream oBuffInputStream = 
                            new BufferedInputStream( oInStream );
            while ((nLength = oBuffInputStream.read(oBytes)) &gt; 0) 
            {
                oOutStream.write(oBytes, 0, nLength);
            }
            oInStream.close();
            oOutStream.close();
    }
}
</code></pre>

<p>where </p>

<pre><code>String from_path=new File("example.tar.gz");
File source=new File(from_path);

File destination=new File("/temp/example_test.tar.gz");
            if(!destination.exists())
                destination.createNewFile();
</code></pre>

<p>and then </p>

<pre><code>copyFile(source, destination);
</code></pre>

<p>but it doesn't work. Path is ok. It prints that files exists. Can anybody help ?</p>
