



Remember this post: Copy a txt file from one location to another with Java ?
Well, I’ve updated the class so that it’s posible to append the input data to the output txt file or to overwrite the existing output txt file with the new data.
I’m planning to use this class to save a log file from my Java ip scanner that can scan open ports that i’m working on so that you can see what port(s) are open for any given ip range.
If you want the sourcecode for the Java ip scanner: i’ll release the sourcecode when it does what I need it to do. Anyway, below is the sourcecode to test the new CopyFile class:
Example code:
import engineeringservercomUtilityPackage.CopyFiles;
public class CopyFileTest {
public static void main(String[] args){
CopyFiles CF = new CopyFiles();
CF.copyFile(”c:\\input.txt” , “c:\\output.txt”, false);
CF.copyFile(”c:\\input.txt” , “c:\\outputAppend.txt”, true);
}
}
The code looks like the previous blogpost but the constructor now takes three parameters instead of two. The boolean is used to append (true) or not to append (false) the input file.
Download CopyFileV2 here: download
Regards,
HappyFace
www.engineeringserver.com


More Options ...
Categories
Tag Cloud
Blog RSS
Comments RSS

Void « Default
Life
Earth
Wind
Water
Fire
Light 