All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.qcloud.cos.internal.COSObjectResponseHandler Maven / Gradle / Ivy

The newest version!
package com.qcloud.cos.internal;

import com.qcloud.cos.http.CosHttpResponse;
import com.qcloud.cos.model.COSObject;
import com.qcloud.cos.model.COSObjectInputStream;
import com.qcloud.cos.model.ObjectMetadata;

public class COSObjectResponseHandler extends AbstractCosResponseHandler {

    @Override
    public CosServiceResponse handle(CosHttpResponse response) throws Exception {
        COSObject object = new COSObject();
        CosServiceResponse cosResponse = parseResponseMetadata(response);

        ObjectMetadata metadata = object.getObjectMetadata();
        populateObjectMetadata(response, metadata);
        object.setObjectContent(
                new COSObjectInputStream(response.getContent(), response.getHttpRequest()));
        cosResponse.setResult(object);
        return cosResponse;
    }
    
    @Override
    public boolean needsConnectionLeftOpen() {
        return true;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy