Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: preserve KnownLength when wrapping InputStream #6852

Merged
merged 1 commit into from Mar 30, 2020

Conversation

herbyderby
Copy link
Contributor

@herbyderby herbyderby commented Mar 23, 2020

useInputStreamMessages ensures that the InputStream supports marking by wrapping the stream in a BufferedInputStream if markSupported() returns false. This change uses a new subclass of BufferedInputStream that also implements KnownLength, when the original stream also implements KnownLength.

@linux-foundation-easycla
Copy link

@linux-foundation-easycla linux-foundation-easycla bot commented Mar 23, 2020

CLA Check
The committers are authorized under a signed CLA.

@zhangkun83 zhangkun83 requested a review from ejona86 Mar 24, 2020
@ejona86
Copy link
Member

@ejona86 ejona86 commented Mar 24, 2020

In places we check for KnownLength we try to check for ByteArrayInputStream as well, explicitly. It seems that is missing in ProtoLiteUtils. We should just fix it to be inputStream instanceof KnownLength || inputStream instanceof ByteArrayInputStream.

(Alternatively we could have a static method that did the check for us. But we'd need to find a home for the method.)

@ejona86
Copy link
Member

@ejona86 ejona86 commented Mar 24, 2020

Oh, I see. This is BufferedInputStream

useInputStreamMessages ensures that the InputStream supports marking by wrapping the stream in a BufferedInputStream if markSupported() returns false. This change uses a new subclass of BufferedInputStream that also implements KnownLength, when the original stream also implements KnownLength.
@zhangkun83 zhangkun83 added the kokoro:force-run label Mar 30, 2020
@grpc-kokoro grpc-kokoro removed the kokoro:force-run label Mar 30, 2020
@zhangkun83 zhangkun83 merged commit a4275b6 into grpc:master Mar 30, 2020
11 of 13 checks passed
dfawley pushed a commit to dfawley/grpc-java that referenced this issue Jan 15, 2021
useInputStreamMessages ensures that the InputStream supports marking by wrapping the stream in a BufferedInputStream if markSupported() returns false. This change uses a new subclass of BufferedInputStream that also implements KnownLength, when the original stream also implements KnownLength.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants