package info.knacki.pass.io;

import android.content.Context;

import java.io.File;

import info.knacki.gitdroid.callback.OnResponseListener;

public interface IFileInterface {

    interface IFileInterfaceCreator {
        IFileInterface Create(Context ctx, FileInterfaceFactory.PasswordGetter passwordGetter, File file);
    }

    class InvalidPasswordException extends Throwable {
        private final String fWhat;

        InvalidPasswordException(String what) {
            super(what);
            fWhat = what;
        }

        @Override
        public String getMessage() {
            return fWhat;
        }
    }

    void ReadFile(OnResponseListener<String> resp);
    void WriteFile(String content, OnResponseListener<Void> resp) throws InvalidPasswordException;
    String GetMethodName();
}
