@Override protected Entity readEntity() throws IOException {
  entity.clear();
  GetObjectRequest rangeObjectRequest=new GetObjectRequest(bucketName,filePath);
  rangeObjectRequest.setRange(offset,blockMetadata.getLength() - 1);
  S3Object objectPortion=s3Client.getObject(rangeObjectRequest);
  S3ObjectInputStream wrappedStream=objectPortion.getObjectContent();
  byte[] record=ByteStreams.toByteArray(wrappedStream);
  entity.setUsedBytes(record.length);
  entity.setRecord(record);
  wrappedStream.close();
  return entity;
}

@ Override protected Entity readEntity ( ) throws IOException { entity . clear ( ) ; GetObjectRequest rangeObjectRequest = new GetObjectRequest ( bucketName , filePath ) ; rangeObjectRequest . setRange ( offset , blockMetadata . getLength ( ) - 1 ) ; S3Object objectPortion = s3Client . getObject ( rangeObjectRequest ) ; S3ObjectInputStream wrappedStream = objectPortion . getObjectContent ( ) ; byte [ ] record = ByteStreams . toByteArray ( wrappedStream ) ; entity . setUsedBytes ( record . length ) ; entity . setRecord ( record ) ; wrappedStream . close ( ) ; return entity ; }
s3 block read would be achieved through the amazons3 client . following are the steps to achieve : ( 1 ) create the objectrequest from bucketname and filepath . ( 2 ) set the range to the above created objectrequest . ( 3 ) get the object portion through amazons3 client api . ( 4 ) get the object content from the above object portion .
