package WriterImplementation;

import WriterInterface.FileWriterInterface;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.logging.Level;
import java.util.logging.Logger;


public class FileWriterImpl implements FileWriterInterface{

    private static FileWriterImpl _fileWriter;
    
    private FileWriterImpl() {
        if( _fileWriter != null ) {
            throw new InstantiationError( "More instances of this object cannot be created." );
        }
    }
    
    private synchronized  static void createInstance(){
        if(_fileWriter==null){
            _fileWriter  = new FileWriterImpl();
        }
    }
    
    public static  FileWriterImpl getInstace(){
        if(_fileWriter==null) createInstance();
        return _fileWriter;
    }
    
    @Override
    public boolean fileExists(String Path) {
        File file = new File(Path);
        return file.exists();
    }

    @Override
    public File fileOpen(String Path) {
         return  new File(Path);
    }

    @Override
    public File fileCreate(String Path) throws IOException{
        File file = new File(Path);
        file.createNewFile();
        return file;
    }

    
    @Override
    public void writeLine(String line, File file) {
         BufferedWriter writer;
        try {
            writer = new BufferedWriter(new FileWriter(file, true));
            writer.append(line+"\n");
            writer.close();
        } catch (FileNotFoundException ex) {
            Logger.getLogger(FileWriterImpl.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedEncodingException ex) {
            Logger.getLogger(FileWriterImpl.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(FileWriterImpl.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @Override
    public void fileDelete(String Path) {
         File file = new File(Path);
         file.delete();        
    }

    @Override
    public void fileDelete(File file) {
        file.delete();
    }

    
}

@@ -1184,25 +1184,25 @@
 eate(String 
-P
+p
 ath) throws 
@@ -1235,39 +1235,121 @@
 file = new File(
-P
+p
 ath);%0A
+        if(path.contains(%22/%22))%7B%0A        %09file.getParentFile().mkdirs();%0A        %7D%0A
         file.cre

Create directories of path that don't exist