/ * CREATED ON 2005-4-17 * * AGRS: Divied File * Todo to change the Template for this generated file go to * window - preferences - java - code style - code templates * / package c12;
import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter;
/ ** * @author zhang * * Todo to change the Template for this generated type comment Go to window - * preferences - java - code style - code templates * / public class dividewordlibrary {
Private static final string filesuffix = ".txt";
Private static final int maxline = 2000;
private static String fileRename (String filename, String suffix, int index) {int maxprefix = filename.toLowerCase () .lastIndexOf (suffix.toLowerCase ()); StringBuffer fileprefix = new StringBuffer (); for (int i = 0; i < MaxPrefix; i ) {fileprefix.append (filename.charat (i));}
Return FilePrefix.Append (Index) .append (SUFFIX.TOLOWERCASE ()). TOSTRING ();
Public static void main (string [] args) {if (args.length <1) {system.out.println ("USAGE: Java DividewordLibrary Source"); System.exit (1);} try {file source = new file (args [0]); // file desc = new file (args [1]); string filename = source.getname (); string path = source.getParent (); string str; int i = 0, index = 0 ;
BufferedReader IN = New FileReader (New FileReader (Source)); PrintWriter out = null; while (Str = in.readLine ())! = Null) {if (i% maxline == 0) {ix (out! = Null ); Out = new printwriter (new filewriter (new filewriter (new file (Path / " Fileres (FileName, FileSuffix, INDEX )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) ); If (out! = Null) Out.close (); System.out.println ("Successful!");} Catch (filenotfoundexception e) {E.PrintStackTrace ();} catch (ooException e) {E.PrintStackTrace ()}}}