Skip to content

Instantly share code, notes, and snippets.

@murat-kilic
Last active September 30, 2019 15:52
Show Gist options
  • Save murat-kilic/35626a7167b0400443510cae46a349a3 to your computer and use it in GitHub Desktop.
Save murat-kilic/35626a7167b0400443510cae46a349a3 to your computer and use it in GitHub Desktop.
FileInputStream fis = new FileInputStream(System.getProperty("java.io.tmpdir")+ File.separator+fileName);
int bufferSize = 256 * 1024;
while ((length = bis.read(buffer, 0, bufferSize)) != -1) {
requestObserver.onNext(
UploadFileRequest.newBuilder().setFileContent(ByteString.copyFrom(buffer, 0, length)).build()
);
requestObserver.onCompleted();
finishLatch.await(1, TimeUnit.MINUTES);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment