Class S3Utils

java.lang.Object
org.apache.hadoop.ozone.s3.util.S3Utils

public final class S3Utils extends Object
Utilities.
  • Method Details

    • urlDecode

      public static String urlDecode(String str) throws UnsupportedEncodingException
      Throws:
      UnsupportedEncodingException
    • urlEncode

      public static String urlEncode(String str) throws UnsupportedEncodingException
      Throws:
      UnsupportedEncodingException
    • resolveS3ClientSideReplicationConfig

      public static org.apache.hadoop.hdds.client.ReplicationConfig resolveS3ClientSideReplicationConfig(String s3StorageTypeHeader, String s3StorageConfigHeader, org.apache.hadoop.hdds.client.ReplicationConfig clientConfiguredReplConfig, org.apache.hadoop.hdds.client.ReplicationConfig bucketReplConfig) throws OS3Exception
      This API used to resolve the client side configuration preference for file system layer implementations.
      Parameters:
      s3StorageTypeHeader - - s3 user passed storage type header.
      clientConfiguredReplConfig - - Client side configured replication config.
      bucketReplConfig - - server side bucket default replication config.
      Returns:
      client resolved replication config.
      Throws:
      OS3Exception
    • toReplicationConfig

      public static org.apache.hadoop.hdds.client.ReplicationConfig toReplicationConfig(String s3StorageType, String s3StorageConfig) throws OS3Exception
      Throws:
      OS3Exception
    • wrapOS3Exception

      public static javax.ws.rs.WebApplicationException wrapOS3Exception(OS3Exception ex)
    • hasUnsignedPayload

      public static boolean hasUnsignedPayload(@Nonnull String amzContentSha256Header)
    • hasMultiChunksPayload

      public static boolean hasMultiChunksPayload(@Nonnull String amzContentSha256Header)
    • validateMultiChunksUpload

      public static void validateMultiChunksUpload(javax.ws.rs.core.HttpHeaders headers, String amzDecodedContentLength, String resource) throws OS3Exception
      Throws:
      OS3Exception
    • validateSignatureHeader

      public static String validateSignatureHeader(javax.ws.rs.core.HttpHeaders headers, String resource, boolean isSignedPayload) throws OS3Exception
      Throws:
      OS3Exception
    • eol

      public static boolean eol(int prev, int curr)
      Checks if the given pair of bytes represent the end-of-line sequence (\r\n).
      Parameters:
      prev - the previous byte value (should be 13 for '\r')
      curr - the current byte value (should be 10 for '\n')
      Returns:
      true if the pair forms a CRLF sequence, false otherwise
    • generateCanonicalUserId

      public static String generateCanonicalUserId(String input)
      Generates a Canonical User ID compatible with S3 by returning the SHA-256 hexadecimal encoding of the input string.
      Parameters:
      input - the input string
      Returns:
      the SHA-256 hexadecimal encoded Canonical User ID