{
if ( !localToFile.exists( ) )
{
if ( !localToFile.createNewFile( ) )
{
throw new ProviderRequestException(
"Could not create target file '"
+ localToFile.getAbsolutePath( ) + "'." );
}
}
RepeatableBufferedCopyStream copyStream =
new RepeatableBufferedCopyStream(
new FileInputStream( localFromFile ),
new FileOutputStream( localToFile )
);
copyStream.copyInputToOutput( );
}
catch ( FileNotFoundException e )
{
throw new ProviderRequestException( e );
}
catch ( IOException e )
{
throw new ProviderRequestException( e );
}
}