Skip to content

Commit

Permalink
wrap in bufferedreader for speed
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavis95 committed Mar 4, 2022
1 parent 1dca751 commit d36549a
Showing 1 changed file with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.Filters;
import com.mongodb.client.model.IndexOptions;
import io.zulia.message.ZuliaBase.*;
import io.zulia.message.ZuliaQuery.*;
import io.zulia.message.ZuliaBase.AssociatedDocument;
import io.zulia.message.ZuliaQuery.FetchType;
import io.zulia.server.config.cluster.S3Config;
import io.zulia.server.filestorage.io.S3OutputStream;
import io.zulia.util.ZuliaUtil;
Expand All @@ -18,9 +18,19 @@
import software.amazon.awssdk.core.sync.RequestBody;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.model.*;

import java.io.*;
import software.amazon.awssdk.services.s3.model.Delete;
import software.amazon.awssdk.services.s3.model.DeleteObjectRequest;
import software.amazon.awssdk.services.s3.model.DeleteObjectsRequest;
import software.amazon.awssdk.services.s3.model.GetObjectRequest;
import software.amazon.awssdk.services.s3.model.GetObjectResponse;
import software.amazon.awssdk.services.s3.model.ObjectIdentifier;
import software.amazon.awssdk.services.s3.model.PutObjectRequest;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Writer;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -194,7 +204,7 @@ public InputStream getAssociatedDocumentStream(String uniqueId, String filename)
Document s3Info = doc.get("s3", Document.class);
GetObjectRequest gor = GetObjectRequest.builder().bucket(s3Info.getString("bucket")).key(s3Info.getString("key")).build();
ResponseInputStream<GetObjectResponse> results = s3.getObject(gor);
return results;
return new BufferedInputStream(results);
}
return null;
}
Expand Down

0 comments on commit d36549a

Please sign in to comment.