danielcweeks commented on code in PR #4608:
URL: https://github.com/apache/iceberg/pull/4608#discussion_r857027618


##########
aws/src/main/java/org/apache/iceberg/aws/s3/S3InputStream.java:
##########
@@ -111,6 +114,19 @@ public int read(byte[] b, int off, int len) throws 
IOException {
     return bytesRead;
   }
 
+  @Override
+  public void readFully(long position, byte[] buffer, int offset, int length) {
+    GetObjectRequest.Builder requestBuilder = GetObjectRequest.builder()
+        .bucket(location.bucket())
+        .key(location.key())
+        .range(String.format("bytes=%s-%s", position, position + length));
+
+    S3RequestUtil.configureEncryption(awsProperties, requestBuilder);
+
+    ResponseBytes<GetObjectResponse> response = 
s3.getObject(requestBuilder.build(), ResponseTransformer.toBytes());

Review Comment:
   Ok, I pulled this into an `IOUtil` class, but I also made it conform to 
other implementations of readFully (i.e. we shouldn't be returning a boolean, 
but rather throwing IOException in the event of reaching EOF).  I put this in 
the `org.apache.iceberg.io` package, but could also live in 
`org.apache.iceberg.util` with some of the other utils.  I don't have a strong 
preference.
   
    



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to