litesoft
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// This Source Code is in the Public Domain per: http://litesoft.org/License.txt
package org.litesoft.util;
import java.io.*;
import org.litesoft.core.typeutils.*;
public class FileReplacer extends AbstractFileAR
{
public static final String VERSION = "1.5";
public static final int MAX_FILE_SIZE = 32 * 1024 * 1024;
public static void main( String[] args )
throws Exception
{
new FileReplacer().process( "FileReplacer", VERSION, args );
}
/**
* Move Dir - Assume same volume!
*/
@Override
protected boolean moveDir( File pSource, File pDestination )
{
DirectoryUtils.deleteIfExists( pDestination );
DirectoryUtils.moveFile( pSource, pDestination );
return true;
}
/**
* Move File - Assume same volume!
*/
@Override
protected boolean moveFile( File pSource, File pDestination )
{
FileUtils.deleteIfExists( pDestination );
DirectoryUtils.moveFile( pSource, pDestination );
return true;
}
/**
* Update the existing pDestination from the pSource - Assume NOT the same volume!
*/
@Override
protected boolean updateFile( File pSource, File pDestination )
{
byte[] srcBytes = FileUtils.load( pSource, MAX_FILE_SIZE );
byte[] dstBytes = FileUtils.load( pDestination, MAX_FILE_SIZE );
if ( !Bytes.areArraysEqual( srcBytes, dstBytes ) )
{
FileUtils.deleteIfExists( pDestination );
FileUtils.store( pDestination, srcBytes );
return true;
}
return false;
}
/**
* Copy the pSource to the pDestination - Assume NOT the same volume!
*/
@Override
protected boolean copyAddFile( File pSource, File pDestination )
{
byte[] zBytes = FileUtils.load( pSource, MAX_FILE_SIZE );
FileUtils.store( pDestination, zBytes );
return true;
}
}
|
Revision |
Author |
Commited |
Message |
812
Diff
|
GeorgeS
|
Sat 18 Aug, 2012 17:45:40 +0000 |
|
809
Diff
|
GeorgeS
|
Thu 16 Aug, 2012 04:10:46 +0000 |
|
80
Diff
|
GeorgeS
|
Fri 29 Oct, 2010 17:23:26 +0000 |
|
76
Diff
|
GeorgeS
|
Wed 27 Oct, 2010 00:24:59 +0000 |
|
73
Diff
|
GeorgeS
|
Mon 25 Oct, 2010 20:47:48 +0000 |
|
72
Diff
|
GeorgeS
|
Mon 25 Oct, 2010 19:13:46 +0000 |
|
71
Diff
|
GeorgeS
|
Mon 25 Oct, 2010 18:30:09 +0000 |
|
49
Diff
|
GeorgeS
|
Mon 12 Apr, 2010 02:59:10 +0000 |
|
24
Diff
|
GeorgeS
|
Wed 24 Feb, 2010 01:51:38 +0000 |
|
2
|
GeorgeS
|
Sun 07 Feb, 2010 12:50:58 +0000 |
|