Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public SomeObjectThatContainsFileForExamplePipedInputStream callSomeMethodAndRecieveDownloadedFileInSomeForm(final String name) throws IOException {
- //here any instance of OutputStream - it needs to be passed to client.getFile lower (for now it is PipedOutputStream)
- PipedInputStream inputStream = new PipedInputStream(); // for now
- PipedOutputStream outputStream = new PipedOutputStream(inputStream);
- //some dropbox client object
- DbxClient client = new DbxClient();
- try {
- //important part - Dropbox API downloads the file from Dropbox servers to the outputstream object passed as the third parameter
- client.getFile("/" + name, null, outputStream);
- } catch (DbxException e){
- e.printStackTrace();
- } finally {
- outputStream.close();
- }
- return inputStream;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement