public static char[] readCharacters(Reader input, int length) throws IOException {
        int count = 0;
        char[] chars = new char[length];
        while (count < length) {
            int n = input.read(chars, count, length - count);
            if (n < 0) {
                try {
                    input.close();
                } catch (IOException e) {
                    // ignore
                }

                throw count == 0 ? new EOFException()
                        : new IOException(ClickHouseUtils
                                .format("Reached end of reader after reading %d of %d characters", count, length));
            }
            count += n;
        }

        return chars;
    }
Reads {@code length} characters from given reader. It behaves in a similar
way as {@link java.io.DataInput#readFully(byte[])}.

@param input  non-null reader
@param length number of characters to read
@return character array and its length should be {@code length}
@throws IOException when failed to read value from input stream, not able to
                    retrieve all bytes, or reached end of the stream
clickhouse-data/src/main/java/com/clickhouse/data/format/BinaryStreamUtils.java