question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `StreamMessage.of(inputStream, bufferSize)`

See original GitHub issue

It would be nice if we provide a way to convert an InputStream to a StreamMessage<HttpData> that splits the binary by the bufferSize.

static StreamMessage<HttpData> of(InputStream inputStream, ByteBufAllocator alloc, int bufferSize) {...}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
nvidyalacommented, Nov 20, 2021

@minwoox Could I try my hand at this?

1reaction
minwooxcommented, Nov 25, 2021

This would return a new class (which implements StreamMessage) that would be capable of taking an InputStream and return bufferSize bytes when demand() is invoked

Yes, exactly. 😄 You might want to take a look at https://github.com/line/armeria/blob/master/core/src/main/java/com/linecorp/armeria/server/file/StreamingHttpFile.java because it’s implemented in that way.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to control the buffer size while reading from a inputstream
I am reading from an input stream from FileItemIterator iter = upload.getItemIterator(request); while (iter.hasNext()) { FileItemStream item ...
Read more >
armeria/StreamMessage.java at master - GitHub
Creates a new {@link StreamMessage} that streams the specified {@link File}. * The default buffer size({@value PathStreamMessage#DEFAULT_FILE_BUFFER_SIZE}) ...
Read more >
BufferedInputStream (Java Platform SE 7 ) - Oracle Help Center
A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the input and to support the mark and reset methods.
Read more >
Stream - Reference Source - Microsoft
421public override Task CopyToAsync(Stream destination, Int32 bufferSize, CancellationToken ... 57public byte[] ComputeHash(Stream inputStream) {.
Read more >
Java BufferedInputStream - Jenkov.com
Except for adding buffering to your input streams, BufferedInputStream behaves exactly like an InputStream . Optimal Buffer Size for a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found