
nl.tweeenveertig.openstack.command.object.DownloadObjectAsInputStreamCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of joss Show documentation
Show all versions of joss Show documentation
Java Client library for OpenStack Storage (Swift)
package nl.tweeenveertig.openstack.command.object;
import nl.tweeenveertig.openstack.model.Account;
import nl.tweeenveertig.openstack.model.Container;
import nl.tweeenveertig.openstack.instructions.DownloadInstructions;
import nl.tweeenveertig.openstack.command.identity.access.AccessImpl;
import nl.tweeenveertig.openstack.model.StoredObject;
import org.apache.http.HttpEntity;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import java.io.IOException;
import java.io.InputStream;
public class DownloadObjectAsInputStreamCommand extends AbstractDownloadObjectCommand {
private InputStream inputStream;
public DownloadObjectAsInputStreamCommand(Account account, HttpClient httpClient, AccessImpl access,
StoredObject object, DownloadInstructions downloadInstructions) {
super(account, httpClient, access, object, downloadInstructions);
}
@Override
protected void handleEntity(HttpEntity entity) throws IOException {
inputStream = new InputStreamWrapper(this, entity.getContent());
}
@Override
protected String getMd5() throws IOException {
return null;
}
@Override
protected InputStream getObjectAsReturnObject() {
return inputStream;
}
@Override
protected boolean closeStreamAutomatically() {
return false;
}
}