You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

sanjeev_hansanur1's avatar
sanjeev_hansanur1
Explorer | Level 4
3 years ago

how to do I get content of a file in Dropboxsdk using java code

how do I get content of a file using dropboxsdk code and we tried with download sdk method but Inputstream is not converting in to proper string

Please help us with some sample code for download where we can convert the inputstream to string

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    You can retrieve file content using the Dropbox Java SDK via the download methods. You can find the documentation for the download methods here. There are also some examples of downloading files using that SDK here and here.

     

    It sounds like you already have an InputStream and need to get a String from it. That's more of a general Java question and so outside the scope of Dropbox API support, but you can find information on doing so in this post, for example.


  • sanjeev_hansanur1 wrote:

    ... convert the inputstream to string


    Hi sanjeev_hansanur1,

    A good way to convert raw input stream to whatever you want (including string) is wrapping it using DataInputStream class. The benefit here is that you don't need buffering, so the need of engaging memory decreases. Processing happens "on flight" (or could be at least, if you code properly - process resulting string, or whatever else, piece by piece - following the streaming conception). 😉

    Hope this helps.