All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.iohao.game.common.kit.adapter.HuIoCopier Maven / Gradle / Ivy

There is a newer version: 21.16
Show newest version
package com.iohao.game.common.kit.adapter;


/**
 * @author 渔民小镇
 * @date 2023-01-19
 */
abstract class HuIoCopier {

    protected final int bufferSize;
    protected final long count;

    protected boolean flushEveryBuffer;

    public HuIoCopier(int bufferSize, long count) {
        this.bufferSize = bufferSize > 0 ? bufferSize : HuIoUtil.DEFAULT_BUFFER_SIZE;
        this.count = count <= 0 ? Long.MAX_VALUE : count;
    }

    public abstract long copy(S source, T target);

    protected int bufferSize(long count) {
        return (int) Math.min(this.bufferSize, count);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy