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

spring.turbo.util.io.BlackHoleWriter Maven / Gradle / Ivy

The newest version!
package spring.turbo.util.io;

import java.io.Writer;

/**
 * @author 应卓
 * @see #getInstance()
 * @since 2.0.0
 * @deprecated 使用 {@link Writer#nullWriter()} 代替
 */
@Deprecated(since = "3.3.1")
public final class BlackHoleWriter extends Writer {

    /**
     * 私有构造方法
     */
    private BlackHoleWriter() {
    }

    /**
     * 获取实例
     *
     * @return 实例
     */
    public static BlackHoleWriter getInstance() {
        return SyncAvoid.INSTANCE;
    }

    @Override
    public void write(char[] buf, int off, int len) {
        // nop
    }

    @Override
    public void flush() {
        // nop
    }

    @Override
    public void close() {
        // nop
    }

    // 延迟加载
    private static class SyncAvoid {
        private static final BlackHoleWriter INSTANCE = new BlackHoleWriter();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy