Skip to content

file download (get) size error #6

@alexdiostia

Description

@alexdiostia

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions