private static FileWriter createPackageFile ( String name , String packageName , String directory , String outDir ) throws IOException { if ( packageName != null && ! packageName . trim ( ) . equals ( "" ) ) { directory = directory + File . separatorChar + packageName . replace ( ' ' , File . separatorChar ) ; } File path = new File ( outDir , directory ) ; if ( ! path . exists ( ) ) { if ( ! path . mkdirs ( ) ) throw new IOException ( "outdir can't be created" ) ; } File file = new File ( path . getAbsolutePath ( ) + File . separatorChar + name ) ; if ( file . exists ( ) ) { if ( ! file . delete ( ) ) throw new IOException ( "there is exist file, please check" ) ; } return new FileWriter ( file ) ; }
Create file in the package