private boolean readFully(byte[] b, int off, int len) throws IOException {
        int n = 0;
        while (n < len) {
            int count = in.read(b, off + n, len - n);
            if (count < 0) {
                if (n == 0) {
                    return false;
                }
                throw new IOException(ClickHouseUtils.format("Incomplete read: {0} of {1}", n, len));
            }
            n += count;
        }

        return true;
    }
Method ensures to read all bytes from the input stream.
In case of network connection it may be a case when not all bytes are read at once.
@throws IOException
client-v2/src/main/java/com/clickhouse/client/api/internal/ClickHouseLZ4InputStream.java