Created
April 19, 2019 03:56
-
-
Save Elfsong/5b2e6898f1ff235acd169c475584430d to your computer and use it in GitHub Desktop.
Sent file in blocksize
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO: FILE_BYTES_REQUEST | |
for (int initial_position = 0; initial_position < qq.fileDescriptor.fileSize; ) { | |
long offset = 0; | |
long remained = qq.fileDescriptor.fileSize - initial_position; | |
if (remained > blockSize) { | |
offset = blockSize; | |
} else { | |
offset = remained; | |
} | |
ByteBuffer content = fileSystemManager.readFile(qq.fileDescriptor.md5, initial_position, offset); | |
String encoded = Base64.getEncoder().encodeToString(content.array()); | |
//TODO: sent encode buffer | |
initial_position += offset; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment