Import Java. io. file; import Java. io. fileinputstream; import Java. io. filenotfoundexception; import Java. io. fileoutputstream; import Java. io. ioexception; import Java. io. inputstreamreader; import Java. io. outputstreamwriter; /*** file operation tool class ** @ author administrator **/public class fileutils {/*** get file extension *** @ Param filename * @ return */public static string getextend (string filename) {return getextend (filename, "");}/*** Get file extension ** @ Param filename * @ return */public static string getextend (string filename, string defext) {If (filename! = NULL) & (filename. length ()> 0) {int I = filename. lastindexof ('. '); If (I> 0) & (I <(filename. length ()-1) {return (filename. substring (I + 1 )). tolowercase () ;}} return defext. tolowercase ();}/*** get file name [without suffix name] ** @ Param * @ return string */public static string getfileprefix (string filename) {int splitindex = filename. lastindexof (". "); Return filename. substring (0, splitindex ). replaceall ("\ s *", "");}/*** File copy * method Abstract: Here is a sentence describing the purpose of the Method * @ Param * @ return void */public static void copyfile (string inputfile, string outputfile) throws filenotfoundexception {file sfile = new file (inputfile); file tfile = new file (outputfile); fileinputstream FD = new fileinputstream (sfile ); fileoutputstream Fos = new fileoutputstream (tfile); inputstreamreader in = NULL; outputstreamwriter out = NULL; int temp = 0; char [] B UF = new char [2048]; try {In = new inputstreamreader (Adams, "UTF-8"); out = new outputstreamwriter (FOS, "UTF-8 "); while (temp = in. read (BUF ))! =-1) {out. write (BUF, 0, temp) ;}} catch (ioexception e) {e. printstacktrace ();} finally {try {In. close (); out. close ();} catch (ioexception e) {e. printstacktrace ();}}} /*** determine whether the file is an image <br> * <br> ** @ Param filename * file name <br> * determine the specific file type <br> * @ return result <br> * @ throws exception */public static Boolean ispicture (string filename) {// If (oconvertutils. isempty (filename) {// return false if the returned result is invalid;} // obtain the file suffix // string tmpname = getextend (filename); string tmpname = filename; // declare the image suffix array string imgearray [] [] = {"BMP", "0" },{ "Dib", "1" },{ "GIF ", "2" },{ "jfif", "3" },{ "jpe", "4" },{ "Jpeg", "5" },{ "jpg ", "6" },{ "PNG", "7" },{ "TIF", "8" },{ "tiff", "9" },{ "ICO ", "10" }}; // retrieve the name array for (INT I = 0; I * <br> ** @ Param filename * file name <br> * determine the specific file type <br> * @ return result <br> * @ throws exception */public static Boolean isdwg (string filename) {// If (oconvertutils. isempty (filename) {// return false if it is not legal;} // get the file suffix string tmpname = getextend (filename); // declare the image suffix array if (tmpname. equals ("DWG") {return true;} return false ;}}