1 /* 2 * Copyright 2014 Jin Kwon. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 18 package com.github.jinahya.simple.file.back; 19 20 21 import java.io.IOException; 22 23 24 /** 25 * An interface for file operation. 26 */ 27 @FunctionalInterface 28 public interface FileBack { 29 30 31 /** 32 * The file operations. 33 */ 34 public static enum FileOperation { 35 36 37 /** 38 * A constant for coping files. 39 */ 40 COPY, 41 /** 42 * A constant for deleting files. 43 */ 44 DELETE, 45 /** 46 * A constant for reading files. 47 */ 48 READ, 49 /** 50 * A constant for writing files. 51 */ 52 WRITE 53 54 55 } 56 57 58 /** 59 * Operates a file operation using various properties stored in specified 60 * {@code fileContext}. 61 * 62 * @param fileContext a file context. 63 * 64 * @throws IOException if an I/O error occurs. 65 * @throws FileBackException if a file back error occurs. 66 */ 67 void operate(FileContext fileContext) throws IOException, FileBackException; 68 69 70 } 71