JavaでS3上ファイルMD5チェック

  /**
   * S3上ファイルのMD5チェック
   * 
   * @param filePath
   * @return
   */
  public static String checkS3MD5(String filePath) {
    String eTag = "";
    try {
      ClientConfiguration configuration = new ClientConfiguration();
      AmazonS3 s3 =
      new AmazonS3Client(awsContext.getAwsCredentials(), configuration);
      S3Object object = s3.getObject(YOUR_BACKET, filePath);
      if (object == null) {
        throw new Exception("S3 object is null : path = " + filePath);
      }
      eTag = object.getObjectMetadata().getETag();
    } catch (AmazonServiceException ase) {
      throw new Exception(ase);
    } catch (AmazonClientException ace) {
      throw new Exception(ace);
    }
    return eTag;
  }