Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Split transfer data because of the size limit of FileChannelImpl #216

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wecharyu
Copy link

What changes

  • Split the data that need to transfer into pieces with a maximum size Integer.MAX_VALUE
  • Add a unit test to cover the case of transferring large data (more than 2GB)

Why needs these changes

In the underlying FileChannelImpl, it can transfer at most 2 GB data at a time, which will cause an error if we transfer more than 2 GB data directly:

if (channel.transferTo(headerLength, count, channel) != count) {
throw new AssertionError("Copied insufficient number of bytes!");
}

@JakeWharton
Copy link
Collaborator

Change looks good. I need to update our CI which I can't do until next week. After that I'll rebase your changes to ensure they pass and merge.

@wecharyu
Copy link
Author

wecharyu commented Aug 5, 2022

Gentle Ping @JakeWharton, btw do we need to release a new version for this fix?

@JakeWharton
Copy link
Collaborator

Forgot about it. I'll try again next week.

@wecharyu
Copy link
Author

Hi @JakeWharton please try this PR this week. Thanks a lot :)

@JakeWharton
Copy link
Collaborator

I have some other work and then I'm going on vacation. Earliest I'll get to this library is in September.

@wecharyu
Copy link
Author

OHOK thank you, have a good vacation~

@elevenfive
Copy link

Hey @JakeWharton just a re-ping, maybe this got lost in the shuffle...

@wecharyu
Copy link
Author

Hi @JakeWharton, please help check this PR at your convenience.

@elevenfive
Copy link

Yearly re-ping? Or close the issue?

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.

3 participants