class SwiftReadFeature implements Read {

    @Override
    public InputStream read(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException {
        try {
            // 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(-1 == 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());
        }
        catch(GenericException e) {
            throw new SwiftExceptionMappingService().map("Download {0} failed", e, file);
        }
        catch(IOException e) {
            throw new DefaultIOExceptionMappingService().map(e, file);
        }
    }

    public  SwiftReadFeature(final SwiftSession session, final SwiftRegionService regionService);

}