12 Mar 2008 @ 10:47 PM 
 

Java Copy files and append text

 


1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 3 out of 5)
Loading ... Loading ...
1,733 views

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

Random posts

Your Ad Here
Tags Categories: Java Posted By: HappyFace
Last Edit: 16 Aug 2008 @ 06 42 PM

EmailPermalink
 

Responses to this post » (None)

 

Post a Comment

You must be logged in to post a comment.

\/ More Options ...
Change Theme...
  • Users » 888
  • Posts/Pages » 1,444
  • Comments » 506
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

Online Users



    No Child Pages.

Forum



    No Child Pages.