com.clickhouse.data.stream.DeferredInputStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clickhouse-data Show documentation
Show all versions of clickhouse-data Show documentation
Data processing utilities for ClickHouse
The newest version!
package com.clickhouse.data.stream;
import java.io.IOException;
import java.io.InputStream;
import com.clickhouse.data.ClickHouseDeferredValue;
public final class DeferredInputStream extends InputStream {
private final ClickHouseDeferredValue ref;
private InputStream in;
protected InputStream getInput() {
return in != null ? in : (in = ref.get());
}
public DeferredInputStream(ClickHouseDeferredValue in) {
this.ref = in;
this.in = null;
}
@Override
public int available() throws IOException {
return getInput().available();
}
@Override
public void close() throws IOException {
getInput().close();
}
@Override
public int read() throws IOException {
return getInput().read();
}
@Override
public int read(byte[] b) throws IOException {
return getInput().read(b);
}
@Override
public int read(byte[] b, int off, int len) throws IOException {
return getInput().read(b, off, len);
}
@Override
public long skip(long n) throws IOException {
return getInput().skip(n);
}
}