@Override
    public InputStream read(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException {
        try {
            if(log.isWarnEnabled()) {
                log.warn(String.format("Disable checksum verification for %s", file));
                // Do not set checksum when metadata key X-Static-Large-Object is present. Disable checksum verification in download filter.
                status.setChecksum(Checksum.NONE);
            }
            final Response response;
            if(status.isAppend()) {
                final HttpRange range = HttpRange.withStatus(status);
                if(TransferStatus.UNKNOWN_LENGTH == range.getEnd()) {
                    response = session.getClient().getObject(regionService.lookup(file),
                            containerService.getContainer(file).getName(), containerService.getKey(file),
                            range.getStart());
                }
                else {
                    response = session.getClient().getObject(regionService.lookup(file),
                            containerService.getContainer(file).getName(), containerService.getKey(file),
                            range.getStart(), range.getLength());
                }
            }
            else {
                response = session.getClient().getObject(regionService.lookup(file),
                        containerService.getContainer(file).getName(), containerService.getKey(file));
            }
            return new HttpMethodReleaseInputStream(response.getResponse(), status);
        }
        catch(GenericException e) {
            throw new SwiftExceptionMappingService().map("Download {0} failed", e, file);
        }
        catch(IOException e) {
            throw new DefaultIOExceptionMappingService().map(e, file);
        }
    }
@Test
    public void testReadRangeUnknownLength() throws Exception {
        final Path container = new Path("test.cyberduck.ch", EnumSet.of(Path.Type.directory, Path.Type.volume));
        container.attributes().setRegion("IAD");
        final Path test = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
        new SwiftTouchFeature(session, new SwiftRegionService(session)).touch(test, new TransferStatus());
        final byte[] content = RandomUtils.nextBytes(1023);
        final SwiftRegionService regionService = new SwiftRegionService(session);
        final HttpResponseOutputStream<StorageObject> out = new SwiftWriteFeature(session, regionService).write(test, new TransferStatus().withLength(content.length), new DisabledConnectionCallback());
        assertNotNull(out);
        new StreamCopier(new TransferStatus(), new TransferStatus()).transfer(new ByteArrayInputStream(content), out);
        out.close();
        assertNotNull(out.getStatus());
        final TransferStatus status = new TransferStatus();
        // Set to unknown length
        status.setLength(-1L);
        status.setAppend(true);
        status.setOffset(100L);
        final InputStream in = new SwiftReadFeature(session, regionService).read(test, status, new DisabledConnectionCallback());
        assertNotNull(in);
        final ByteArrayOutputStream buffer = new ByteArrayOutputStream(content.length - 100);
        new StreamCopier(status, status).transfer(in, buffer);
        final byte[] reference = new byte[content.length - 100];
        System.arraycopy(content, 100, reference, 0, content.length - 100);
        assertArrayEquals(reference, buffer.toByteArray());
        in.close();
        new SwiftDeleteFeature(session).delete(Collections.<Path>singletonList(test), new DisabledLoginCallback(), new Delete.DisabledCallback());
    }