Skip to content

file download (get) size error #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
alexdiostia opened this issue Nov 27, 2018 · 0 comments
Open

file download (get) size error #6

alexdiostia opened this issue Nov 27, 2018 · 0 comments

Comments

@alexdiostia
Copy link

Hi there
i'm trying to get the files but face the issue that the get method returns a stream whose size:

  1. equals 0 through stream.available(), so the byte array is empty when reading the stream
  2. returns a size which is bigger than it should through getContentLength(). In that case i do receive a stream which contains the file somehow... but the file appears to be corrupted, with lots of trailing 00 bytes...

ConsumingInputStream stream = sardine.get( theUrl);
long size= stream.getContentLength();//inputStream.available();

then writing with some basic :
FileOutputStream outStream = new FileOutputStream(targetFile);
outStream.write(buffer);
outStream.flush();
outStream.close();

thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant