
com.github.jinahya.simple.file.back.FileContext Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2014 Jin Kwon <jinahya_at_gmail.com>.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.jinahya.simple.file.back;
import com.github.jinahya.simple.file.back.FileBack.FileOperation;
import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
import java.util.Optional;
import static java.util.Optional.ofNullable;
import java.util.function.Consumer;
import java.util.function.Supplier;
/**
* A context between clients and file backs.
*
* @author Jin Kwon <jinahya_at_gmail.com>
*/
public interface FileContext {
/**
* Properties can be configured within file contexts.
*/
public static enum PropertyKey {
/**
* A constant for the key of a property whose value is an instance of
* {@code Supplier} which supplies the target operation.
*/
FILE_OPERATION_SUPPLIER,
/**
* A constant for the key of a property whose value is an instance of
* {@code Consumer} which consumes the path name.
*/
PATH_NAME_CONSUMER,
/**
* A constant for the key of a property whose values si an instance of
* {@code Supplier} which supplies the path name.
*/
PATH_NAME_SUPPLIER,
/**
* A constant for the key of a property whose value is an instance of
* {@code Consumer} which consumes source file
* channel.
*/
SOURCE_CHANNEL_CONSUMER,
/**
* A constant for the key of a property whose value is an instance of
* {@code Consumer} which consumes the target file
* channel.
*/
TARGET_CHANNEL_CONSUMER,
/**
* A constant for the key of a property whose value is an instance of
* {@code Supplier} which supplies the source file
* channel.
*/
SOURCE_CHANNEL_SUPPLIER,
/**
* A constant for the key of a property whose value is an instance of
* {@code Supplier} which supplies a target file
* channel.
*/
TARGET_CHANNEL_SUPPLIER,
/**
* A constants for the key of a property whose value is an instance of
* {@code Consumer} which consumes the number of bytes copied from
* the source file part.
*/
SOURCE_COPIED_CONSUMER,
/**
* A constant for the key of a property whose value is an instance of
* {@code Consumer} which consumes the number of bytes copied to
* target file part.
*/
TARGET_COPIED_CONSUMER,
/**
* A constant for the key of a property whose value is an instance of
* {@code Supplier} which supplies the key bytes for
* locating the source file part.
*/
SOURCE_KEY_SUPPLIER,
/**
* A constant for the key of a property whose value is an instance of
* {@code Supplier} which supplies the key bytes the
* locating the target file part.
*/
TARGET_KEY_SUPPLIER,
/**
* A constant for the key of a property whose value is an instance of
* {@code Consumer
© 2015 - 2025 Weber Informatics LLC | Privacy Policy