Compartilhar via


BlobUrlParts Class

  • java.lang.Object
    • com.azure.storage.blob.BlobUrlParts

public final class BlobUrlParts

This class represents the components that make up an Azure Storage Container/Blob URL. You may parse an existing URL into its parts with the parse(URL url) class. You may construct a URL from parts by calling toUrl().

Constructor Summary

Constructor Description
BlobUrlParts()

Initializes a BlobUrlParts object which helps aid in the construction of a Blob Storage URL.

Method Summary

Modifier and Type Method and Description
String getAccountName()

Gets the accountname, ex.

String getBlobContainerName()

Gets the container name that will be used as part of the URL path.

String getBlobName()

Decodes and gets the blob name that will be used as part of the URL path.

CommonSasQueryParameters getCommonSasQueryParameters()

Gets the CommonSasQueryParameters representing the SAS query parameters that will be used to generate the SAS token for this URL.

String getHost()

Gets the URL host, ex.

BlobServiceSasQueryParameters getSasQueryParameters()

Deprecated

Gets the BlobServiceSasQueryParameters representing the SAS query parameters

String getScheme()

Gets the URL scheme, ex.

String getSnapshot()

Gets the snapshot identifier that will be used as part of the query string if set.

Map<String,String[]> getUnparsedParameters()

Gets the query string parameters that aren't part of the SAS token that will be used by this URL.

String getVersionId()

Gets the version identifier that will be used as part of the query string if set.

static BlobUrlParts parse(String url)

Parses a string into a BlobUrlParts.

static BlobUrlParts parse(URL url)

Parses an existing URL into a BlobUrlParts.

BlobUrlParts parseSasQueryParameters(String queryParams)

Sets the CommonSasQueryParameters representing the SAS query parameters that will be used to generate the SAS token for this URL.

BlobUrlParts setAccountName(String accountName)

Sets the account name.

BlobUrlParts setBlobName(String blobName)

Sets the blob name that will be used as part of the URL path.

BlobUrlParts setCommonSasQueryParameters(CommonSasQueryParameters commonSasQueryParameters)

Sets the CommonSasQueryParameters representing the SAS query parameters that will be used to generate the SAS token for this URL.

BlobUrlParts setContainerName(String containerName)

Sets the container name that will be used as part of the URL path.

BlobUrlParts setHost(String host)

Sets the URL host, ex.

BlobUrlParts setSasQueryParameters(BlobServiceSasQueryParameters blobServiceSasQueryParameters)

Deprecated

Sets the BlobServiceSasQueryParameters representing the SAS query parameters.

BlobUrlParts setScheme(String scheme)

Sets the URL scheme, ex.

BlobUrlParts setSnapshot(String snapshot)

Sets the snapshot identifier that will be used as part of the query string if set.

BlobUrlParts setUnparsedParameters(Map<String,String[]> unparsedParameters)

Sets the query string parameters that aren't part of the SAS token that will be used by this URL.

BlobUrlParts setVersionId(String versionId)

Sets the version identifier that will be used as part of the query string if set.

URL toUrl()

Converts the blob URL parts to a URL.

Methods inherited from java.lang.Object

Constructor Details

BlobUrlParts

public BlobUrlParts()

Initializes a BlobUrlParts object which helps aid in the construction of a Blob Storage URL.

Method Details

getAccountName

public String getAccountName()

Gets the accountname, ex. "myaccountname".

Returns:

the account name.

getBlobContainerName

public String getBlobContainerName()

Gets the container name that will be used as part of the URL path.

Returns:

the container name.

getBlobName

public String getBlobName()

Decodes and gets the blob name that will be used as part of the URL path.

Returns:

the decoded blob name.

getCommonSasQueryParameters

public CommonSasQueryParameters getCommonSasQueryParameters()

Gets the CommonSasQueryParameters representing the SAS query parameters that will be used to generate the SAS token for this URL.

Returns:

getHost

public String getHost()

Gets the URL host, ex. "account.blob.core.windows.net" or "127.0.0.1:10000".

Returns:

the URL host.

getSasQueryParameters

@Deprecated
public BlobServiceSasQueryParameters getSasQueryParameters()

Deprecated

Gets the BlobServiceSasQueryParameters representing the SAS query parameters

Returns:

getScheme

public String getScheme()

Gets the URL scheme, ex. "https".

Returns:

the URL scheme.

getSnapshot

public String getSnapshot()

Gets the snapshot identifier that will be used as part of the query string if set.

Returns:

the snapshot identifier.

getUnparsedParameters

public Map getUnparsedParameters()

Gets the query string parameters that aren't part of the SAS token that will be used by this URL.

Returns:

the non-SAS token query string values.

getVersionId

public String getVersionId()

Gets the version identifier that will be used as part of the query string if set.

Returns:

the version identifier.

parse

public static BlobUrlParts parse(String url)

Parses a string into a BlobUrlParts.

Query parameters will be parsed into two properties, BlobServiceSasQueryParameters which contains all SAS token related values and getUnparsedParameters() which is all other query parameters.

If a URL points to a blob in the root container, and the root container is referenced implicitly, i.e. there is no path element for the container, the name of this blob in the root container will be set as the containerName field in the resulting BlobURLParts.

Parameters:

url - The URL to be parsed.

Returns:

A BlobUrlParts object containing all the components of a BlobURL.

parse

public static BlobUrlParts parse(URL url)

Parses an existing URL into a BlobUrlParts.

Query parameters will be parsed into two properties, BlobServiceSasQueryParameters which contains all SAS token related values and getUnparsedParameters() which is all other query parameters.

If a URL points to a blob in the root container, and the root container is referenced implicitly, i.e. there is no path element for the container, the name of this blob in the root container will be set as the containerName field in the resulting BlobURLParts.

Parameters:

url - The URL to be parsed.

Returns:

A BlobUrlParts object containing all the components of a BlobURL.

parseSasQueryParameters

public BlobUrlParts parseSasQueryParameters(String queryParams)

Sets the CommonSasQueryParameters representing the SAS query parameters that will be used to generate the SAS token for this URL.

Parameters:

queryParams - The SAS query parameter string.

Returns:

the updated BlobUrlParts object.

setAccountName

public BlobUrlParts setAccountName(String accountName)

Sets the account name.

Parameters:

accountName - The account name.

Returns:

the updated BlobURLParts object.

setBlobName

public BlobUrlParts setBlobName(String blobName)

Sets the blob name that will be used as part of the URL path.

Parameters:

blobName - The blob name. If the blob name contains special characters, pass in the url encoded version of the blob name.

Returns:

the updated BlobUrlParts object.

setCommonSasQueryParameters

public BlobUrlParts setCommonSasQueryParameters(CommonSasQueryParameters commonSasQueryParameters)

Sets the CommonSasQueryParameters representing the SAS query parameters that will be used to generate the SAS token for this URL.

Parameters:

commonSasQueryParameters - The SAS query parameters.

Returns:

the updated BlobUrlParts object.

setContainerName

public BlobUrlParts setContainerName(String containerName)

Sets the container name that will be used as part of the URL path.

Parameters:

containerName - The container nme.

Returns:

the updated BlobUrlParts object.

setHost

public BlobUrlParts setHost(String host)

Sets the URL host, ex. "account.blob.core.windows.net" or "127.0.0.1:10000".

Parameters:

host - The URL host.

Returns:

the updated BlobUrlParts object.

setSasQueryParameters

@Deprecated
public BlobUrlParts setSasQueryParameters(BlobServiceSasQueryParameters blobServiceSasQueryParameters)

Deprecated

Sets the BlobServiceSasQueryParameters representing the SAS query parameters.

Parameters:

blobServiceSasQueryParameters - The SAS query parameters.

Returns:

the updated BlobUrlParts object.

setScheme

public BlobUrlParts setScheme(String scheme)

Sets the URL scheme, ex. "https".

Parameters:

scheme - The URL scheme.

Returns:

the updated BlobUrlParts object.

setSnapshot

public BlobUrlParts setSnapshot(String snapshot)

Sets the snapshot identifier that will be used as part of the query string if set.

Parameters:

snapshot - The snapshot identifier.

Returns:

the updated BlobUrlParts object.

setUnparsedParameters

public BlobUrlParts setUnparsedParameters(Map unparsedParameters)

Sets the query string parameters that aren't part of the SAS token that will be used by this URL.

Parameters:

unparsedParameters - The non-SAS token query string values.

Returns:

the updated BlobUrlParts object.

setVersionId

public BlobUrlParts setVersionId(String versionId)

Sets the version identifier that will be used as part of the query string if set.

Parameters:

versionId - The version identifier.

Returns:

the updated BlobUrlParts object.

toUrl

public URL toUrl()

Converts the blob URL parts to a URL.

Returns:

A URL to the blob resource composed of all the elements in this object.

Applies to