io.activej.fs.ForwardingActiveFs Maven / Gradle / Ivy
Show all versions of activej-fs Show documentation
/*
* Copyright (C) 2020 ActiveJ LLC.
*
* 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 io.activej.fs;
import io.activej.bytebuf.ByteBuf;
import io.activej.csp.ChannelConsumer;
import io.activej.csp.ChannelSupplier;
import io.activej.promise.Promise;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Map;
import java.util.Set;
/**
* An implementation of {@link ActiveFs} that forwards all the calls to the underlying {@link ActiveFs}.
* May be suitable for creating decorators that override certain behaviour of file system.
*
* Inherits all the limitations of underlying {@link ActiveFs}
*/
public abstract class ForwardingActiveFs implements ActiveFs {
private final ActiveFs peer;
protected ForwardingActiveFs(ActiveFs peer) {
this.peer = peer;
}
@Override
public Promise> upload(@NotNull String name) {
return peer.upload(name);
}
@Override
public Promise> upload(@NotNull String name, long size) {
return peer.upload(name, size);
}
@Override
public Promise> append(@NotNull String name, long offset) {
return peer.append(name, offset);
}
@Override
public Promise> download(@NotNull String name, long offset, long limit) {
return peer.download(name, offset, limit);
}
@Override
public Promise> download(@NotNull String name) {
return peer.download(name);
}
@Override
public Promise delete(@NotNull String name) {
return peer.delete(name);
}
@Override
public Promise deleteAll(Set toDelete) {
return peer.deleteAll(toDelete);
}
@Override
public Promise copy(@NotNull String name, @NotNull String target) {
return peer.copy(name, target);
}
@Override
public Promise copyAll(Map sourceToTarget) {
return peer.copyAll(sourceToTarget);
}
@Override
public Promise move(@NotNull String name, @NotNull String target) {
return peer.move(name, target);
}
@Override
public Promise moveAll(Map sourceToTarget) {
return peer.moveAll(sourceToTarget);
}
@Override
public Promise