-
Notifications
You must be signed in to change notification settings - Fork 139
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
feat(java): allow streaming byte requests #4765
feat(java): allow streaming byte requests #4765
Conversation
@@ -58,4 +61,9 @@ public void upload(byte[] request, RequestOptions requestOptions) { | |||
throw new SeedBytesException("Network error executing HTTP request", e); | |||
} | |||
} | |||
|
|||
// Overload for backward compatibility | |||
public void upload(byte[] request, RequestOptions requestOptions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thoughts on moving the direct bytes request to this?
Claude gave me these downsides but to me seems worth the cleanliness / reuse
Potential downsides of the upload overload:
Memory Usage:
The original implementation used the byte array directly.
The new overload wraps the byte array in a ByteArrayInputStream, which is then wrapped in a FileStream.
While ByteArrayInputStream is generally efficient, it does create an additional object in memory.
Performance Overhead:
There's a slight performance cost in creating the additional objects (ByteArrayInputStream and FileStream).
The streaming approach might introduce a small amount of overhead compared to sending the byte array directly, especially for small files."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great idea
/** | ||
* Represents a file stream with associated metadata for file uploads. | ||
*/ | ||
public class FileStream { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't actually need this for bytes requests, going to delete unless anyone votes I keep it around
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome, may be useful to keep around to make it better for multipart (just as a uncopied utility)
- changelogEntry: | ||
- summary: | | ||
Bump Jackson version to latest (2.17.2) | ||
type: chore | ||
createdAt: '2024-09-26' | ||
irVersion: 46 | ||
version: 1.2.0 | ||
version: 2.2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was a blunder 😅
thankfully, we never previously released a 1.2.0
and niels won't be using that until next week
I deleted this erroneous 1.2.0
tag from docker hub
…ads' of https://github.com/fern-api/fern into burke/fer-2593-assemblyai-support-streams-for-file-uploads
…ads' of https://github.com/fern-api/fern into burke/fer-2593-assemblyai-support-streams-for-file-uploads
No description provided.