|
8 | 8 | import java.util.List;
|
9 | 9 | import java.util.concurrent.ExecutorService;
|
10 | 10 | import java.util.function.Function;
|
| 11 | +import java.util.function.Supplier; |
11 | 12 |
|
12 | 13 | import org.springframework.beans.factory.annotation.Autowired;
|
13 | 14 | import org.springframework.beans.factory.annotation.Qualifier;
|
14 | 15 | import org.springframework.beans.factory.annotation.Value;
|
15 | 16 | import org.springframework.stereotype.Component;
|
16 | 17 |
|
| 18 | +import com.amazonaws.AmazonClientException; |
| 19 | +import com.amazonaws.AmazonServiceException; |
17 | 20 | import com.amazonaws.services.s3.AmazonS3Client;
|
18 | 21 | import com.amazonaws.services.s3.model.DeleteObjectsRequest;
|
19 | 22 | import com.amazonaws.services.s3.model.DeleteObjectsRequest.KeyVersion;
|
@@ -147,6 +150,49 @@ public void delete(String bucketName, List<KeyVersion> objects) {
|
147 | 150 | public static InputStream emptyInputStream() {
|
148 | 151 | return emptyInputStream;
|
149 | 152 | }
|
| 153 | + |
| 154 | + /** |
| 155 | + * Method returns InputStream from S3Object. Multi-part download is used to |
| 156 | + * get file. s3.tmp.dir property used to store temporary files. |
| 157 | + * |
| 158 | + * @param bucketName |
| 159 | + * @param key |
| 160 | + * @return |
| 161 | + * @throws AmazonServiceException |
| 162 | + * @throws AmazonClientException |
| 163 | + * @throws InterruptedException |
| 164 | + * @throws IOException |
| 165 | + * |
| 166 | + * This method is deprecated as it is now provided by ReadUtils |
| 167 | + */ |
| 168 | + @Deprecated |
| 169 | + public InputStream getInputStream(String bucketName, String key) |
| 170 | + throws AmazonServiceException, AmazonClientException, InterruptedException, IOException{ |
| 171 | + return readUtils.getInputStream(bucketName, key); |
| 172 | + } |
| 173 | + |
| 174 | + /** |
| 175 | + * Method returns InputStream from S3Object. Multi-part download is used to |
| 176 | + * get file. s3.tmp.dir property used to store temporary files. You can |
| 177 | + * specify temporary file name by using tempFileSupplier object. |
| 178 | + * |
| 179 | + * @param bucketName |
| 180 | + * @param key |
| 181 | + * - |
| 182 | + * @param tempFileSupplier |
| 183 | + * - Supplier providing temporary filenames |
| 184 | + * @return InputStream of |
| 185 | + * @throws AmazonServiceException |
| 186 | + * @throws AmazonClientException |
| 187 | + * @throws InterruptedException |
| 188 | + * @throws IOException |
| 189 | + * |
| 190 | + * This method is deprecated as it is now provided by ReadUtils |
| 191 | + */ |
| 192 | + @Deprecated |
| 193 | + public InputStream getInputStream(String bucketName, String key, Supplier<File> tempFileSupplier) throws AmazonServiceException, AmazonClientException, InterruptedException, IOException{ |
| 194 | + return readUtils.getInputStream(bucketName, key, tempFileSupplier); |
| 195 | + } |
150 | 196 |
|
151 | 197 | static class EmptyInputStream extends InputStream {
|
152 | 198 |
|
|
0 commit comments