データを書き込む必要があり、次のようにAmazon S3
使用OutputStream
してデータを書き込みますInputStream
final PipedOutputStream outputStream = new PipedOutputStream();
final PipedInputStream inputStream;
try {
inputStream = new PipedInputStream(outputStream);
new Thread(
new Runnable() {
@Override
public void run() {
PutObjectRequest putObjectRequest = new PutObjectRequest(S3EnvironmentConfigurator.BucketTypes.source.name(), getProposalName(uniqueId), inputStream, null);
amazonS3Client.putObject(putObjectRequest);
try {
inputStream.close();
} catch (IOException e) {
}
}
}
).start();
今amazonS3Client.putObject
のように見えます
@Override
public PutObjectResult putObject(@Nonnull final PutObjectRequest putObjectRequest)
throws AmazonClientException, AmazonServiceException {
try {
InputStreamReader is = new InputStreamReader(new GZIPInputStream(putObjectRequest.getInputStream()));
StringBuilder sb=new StringBuilder();
BufferedReader br = new BufferedReader(is);
String read = br.readLine();
while(read != null) {
System.out.println(read);
read =br.readLine();
}
} catch (IOException e) {
//ignore
}
return super.putObject(putObjectRequest);
- これは現在、コンソールのコンテンツを出力します
必要
どうすれば次のようなことができますか
while (putObjectRequest.getInputStream() is not completely available) {
// wait
}
// write inputStream, the entire InputStream is ready and available for processing