public static CharStream fromStream(InputStream is, Charset charset, long inputSize) throws IOException {
		try (ReadableByteChannel channel = Channels.newChannel(is)) {
			return fromChannel(
				channel,
				charset,
				DEFAULT_BUFFER_SIZE,
				CodingErrorAction.REPLACE,
				IntStream.UNKNOWN_SOURCE_NAME,
				inputSize);
		}
	}
Creates a {@link CharStream} given an opened {@link InputStream} and the
charset of the bytes contained in the stream.

Reads the entire contents of the {@code InputStream} into
the result before returning, then closes the {@code InputStream}.
runtime/Java/src/org/antlr/v4/runtime/CharStreams.java