共用方式為


AccessCondition Class

  • java.lang.Object
    • com.microsoft.azure.storage.AccessCondition

public class AccessCondition

Represents a set of access conditions to be used for operations against the storage services.

Constructor Summary

Constructor Description
AccessCondition()

Creates an instance of the class.

Method Summary

Modifier and Type Method and Description
void applyAppendConditionToRequest(final HttpURLConnection request)

RESERVED FOR INTERNAL USE. Applies the access condition to the request.

void applyConditionToRequest(final HttpURLConnection request)

RESERVED FOR INTERNAL USE. Applies the access conditions to the request.

void applyLeaseConditionToRequest(final HttpURLConnection request)

RESERVED FOR INTERNAL USE. Applies the lease access condition to the request.

void applySequenceConditionToRequest(final HttpURLConnection request)

RESERVED FOR INTERNAL USE. Applies the sequence number access conditions to the request.

void applySourceConditionToRequest(final HttpURLConnection request)

RESERVED FOR INTERNAL USE. Applies the source access conditions to the request.

AccessCondition generateEmptyCondition()

Generates a new empty AccessCondition.

For more information, see Specifying Conditional Headers for Blob Service Operations.

AccessCondition generateIfExistsCondition()

Returns an access condition such that an operation will be performed only if the resource exists on the service.

Setting this access condition modifies the request to include the HTTP If-Match conditional header.

For more information, see Specifying Conditional Headers for Blob Service Operations.

AccessCondition generateIfMatchCondition(final String etag)

Returns an access condition such that an operation will be performed only if the resource's ETag value matches the specified ETag value.

Setting this access condition modifies the request to include the HTTP If-Match conditional header. If this access condition is set, the operation is performed only if the ETag of the resource matches the specified ETag.

For more information, see Specifying Conditional Headers for Blob Service Operations.

AccessCondition generateIfModifiedSinceCondition(final Date lastMotified)

Returns an access condition such that an operation will be performed only if the resource has been modified since the specified time.

Setting this access condition modifies the request to include the HTTP If-Modified-Since conditional header. If this access condition is set, the operation is performed only if the resource has been modified since the specified time.

For more information, see Specifying Conditional Headers for Blob Service Operations.

AccessCondition generateIfNoneMatchCondition(final String etag)

Returns an access condition such that an operation will be performed only if the resource's ETag value does not match the specified ETag value.

Setting this access condition modifies the request to include the HTTP If-None-Match conditional header. If this access condition is set, the operation is performed only if the ETag of the resource does not match the specified ETag.

For more information, see Specifying Conditional Headers for Blob Service Operations.

AccessCondition generateIfNotExistsCondition()

Returns an access condition such that an operation will be performed only if the resource does not exist on the service.

Setting this access condition modifies the request to include the HTTP If-None-Match conditional header.

For more information, see Specifying Conditional Headers for Blob Service Operations.

AccessCondition generateIfNotModifiedSinceCondition(final Date lastMotified)

Returns an access condition such that an operation will be performed only if the resource has not been modified since the specified time.

Setting this access condition modifies the request to include the HTTP If-Unmodified-Since conditional header. If this access condition is set, the operation is performed only if the resource has not been modified since the specified time.

For more information, see Specifying Conditional Headers for Blob Service Operations.

AccessCondition generateIfSequenceNumberEqualCondition(long sequenceNumber)

Returns an access condition such that an operation will be performed only if resource's current sequence number is equal to the specified value. This condition only applies to page blobs.

AccessCondition generateIfSequenceNumberLessThanCondition(long sequenceNumber)

Returns an access condition such that an operation will be performed only if resource's current sequence number is less than the specified value. This condition only applies to page blobs.

AccessCondition generateIfSequenceNumberLessThanOrEqualCondition(long sequenceNumber)

Returns an access condition such that an operation will be performed only if resource's current sequence number is less than or equal to the specified value. This condition only applies to page blobs.

AccessCondition generateLeaseCondition(final String leaseID)

Returns an access condition such that an operation will be performed only if the resource is accessible under the specified lease ID.

For more information, see Specifying Conditional Headers for Blob Service Operations.

Long getIfAppendPositionEqual()

Gets the value for a conditional header used only for append operations. A number indicating the byte offset to check for. The append will succeed only if the end position is equal to this number.

String getIfMatch()

Gets the ETag when the If-Match condition is set.

Long getIfMaxSizeLessThanOrEqual()

Gets the value for a conditional header used only for append operations. A number that indicates the maximum length in bytes to restrict the blob to when committing the block.

Date getIfModifiedSinceDate()

Gets the If-Modified-Since date.

String getIfNoneMatch()

Gets the ETag when the If-None-Match condition is set.

Long getIfSequenceNumberEqual()

Gets the sequence number when the sequence number equal condition is set. This condition is only applicable to page blobs.

Long getIfSequenceNumberLessThan()

Gets the sequence number when the sequence number less than condition is set. This condition is only applicable to page blobs.

Long getIfSequenceNumberLessThanOrEqual()

Gets the sequence number when the sequence number less than or equal condition is set. This condition is only applicable to page blobs.

Date getIfUnmodifiedSinceDate()

Gets the If-Unmodified-Since date.

String getLeaseID()

Gets the lease ID.

void setIfAppendPositionEqual(Long ifAppendPositionEqual)

Sets the value for a conditional header used only for append operations. A number indicating the byte offset to check for. The append will succeed only if the end position is equal to this number.

void setIfMatch(String etag)

Sets the ETag for the If-Match condition.

void setIfMaxSizeLessThanOrEqual(Long ifMaxSizeLessThanOrEqual)

Sets the value for a conditional header used only for append operations. A number that indicates the maximum length in bytes to restrict the blob to when committing the block.

void setIfModifiedSinceDate(Date ifModifiedSinceDate)

Sets the If-Modified-Since date.

void setIfNoneMatch(String etag)

Sets the ETag for the If-None-Match condition.

void setIfSequenceNumberEqual(Long sequenceNumber)

Sets the sequence number for the sequence number equal to condition. This condition is only applicable to page blobs.

void setIfSequenceNumberLessThan(Long sequenceNumber)

Sets the sequence number for the sequence number less than condition. This condition is only applicable to page blobs.

void setIfSequenceNumberLessThanOrEqual(Long sequenceNumber)

Sets the sequence number for the sequence number less than or equal to condition. This condition is only applicable to page blobs.

void setIfUnmodifiedSinceDate(Date ifUnmodifiedSinceDate)

Sets the If-Unmodified-Since date.

void setLeaseID(String leaseID)

Gets the lease ID.

boolean verifyConditional(final String etag, final Date lastModified)

RESERVED FOR INTERNAL USE. Verifies the condition is satisfied.

Constructor Details

AccessCondition

public AccessCondition()

Creates an instance of the class.

Method Details

applyAppendConditionToRequest

public void applyAppendConditionToRequest(final HttpURLConnection request)

RESERVED FOR INTERNAL USE. Applies the access condition to the request.

Parameters:

request - A java.net.HttpURLConnection object that represents the request to which the condition is being applied.

applyConditionToRequest

public void applyConditionToRequest(final HttpURLConnection request)

RESERVED FOR INTERNAL USE. Applies the access conditions to the request.

Parameters:

request - A java.net.HttpURLConnection object that represents the request to which the condition is being applied.

applyLeaseConditionToRequest

public void applyLeaseConditionToRequest(final HttpURLConnection request)

RESERVED FOR INTERNAL USE. Applies the lease access condition to the request.

Parameters:

request - A java.net.HttpURLConnection object that represents the request to which the condition is being applied.

applySequenceConditionToRequest

public void applySequenceConditionToRequest(final HttpURLConnection request)

RESERVED FOR INTERNAL USE. Applies the sequence number access conditions to the request.

Parameters:

request - A java.net.HttpURLConnection object that represents the request to which the condition is being applied.

applySourceConditionToRequest

public void applySourceConditionToRequest(final HttpURLConnection request)

RESERVED FOR INTERNAL USE. Applies the source access conditions to the request.

Parameters:

request - A java.net.HttpURLConnection object that represents the request to which the condition is being applied.

generateEmptyCondition

public static AccessCondition generateEmptyCondition()

Generates a new empty AccessCondition.

For more information, see Specifying Conditional Headers for Blob Service Operations.

Returns:

An AccessCondition object that has no conditions set.

generateIfExistsCondition

public static AccessCondition generateIfExistsCondition()

Returns an access condition such that an operation will be performed only if the resource exists on the service.

Setting this access condition modifies the request to include the HTTP If-Match conditional header.

For more information, see Specifying Conditional Headers for Blob Service Operations.

Returns:

An AccessCondition object that represents the if exists condition.

generateIfMatchCondition

public static AccessCondition generateIfMatchCondition(final String etag)

Returns an access condition such that an operation will be performed only if the resource's ETag value matches the specified ETag value.

Setting this access condition modifies the request to include the HTTP If-Match conditional header. If this access condition is set, the operation is performed only if the ETag of the resource matches the specified ETag.

For more information, see Specifying Conditional Headers for Blob Service Operations.

Parameters:

etag - A String that represents the ETag value to check.

Returns:

An AccessCondition object that represents the If-Match condition.

generateIfModifiedSinceCondition

public static AccessCondition generateIfModifiedSinceCondition(final Date lastMotified)

Returns an access condition such that an operation will be performed only if the resource has been modified since the specified time.

Setting this access condition modifies the request to include the HTTP If-Modified-Since conditional header. If this access condition is set, the operation is performed only if the resource has been modified since the specified time.

For more information, see Specifying Conditional Headers for Blob Service Operations.

Parameters:

lastMotified - A java.util.Date object that represents the last-modified time to check for the resource.

Returns:

An AccessCondition object that represents the If-Modified-Since condition.

generateIfNoneMatchCondition

public static AccessCondition generateIfNoneMatchCondition(final String etag)

Returns an access condition such that an operation will be performed only if the resource's ETag value does not match the specified ETag value.

Setting this access condition modifies the request to include the HTTP If-None-Match conditional header. If this access condition is set, the operation is performed only if the ETag of the resource does not match the specified ETag.

For more information, see Specifying Conditional Headers for Blob Service Operations.

Parameters:

etag - A String that represents the ETag value to check.

Returns:

An AccessCondition object that represents the If-None-Match condition.

generateIfNotExistsCondition

public static AccessCondition generateIfNotExistsCondition()

Returns an access condition such that an operation will be performed only if the resource does not exist on the service.

Setting this access condition modifies the request to include the HTTP If-None-Match conditional header.

For more information, see Specifying Conditional Headers for Blob Service Operations.

Returns:

An AccessCondition object that represents the if not exists condition.

generateIfNotModifiedSinceCondition

public static AccessCondition generateIfNotModifiedSinceCondition(final Date lastMotified)

Returns an access condition such that an operation will be performed only if the resource has not been modified since the specified time.

Setting this access condition modifies the request to include the HTTP If-Unmodified-Since conditional header. If this access condition is set, the operation is performed only if the resource has not been modified since the specified time.

For more information, see Specifying Conditional Headers for Blob Service Operations.

Parameters:

lastMotified - A java.util.Date object that represents the last-modified time to check for the resource.

Returns:

An AccessCondition object that represents the If-Unmodified-Since condition.

generateIfSequenceNumberEqualCondition

public static AccessCondition generateIfSequenceNumberEqualCondition(long sequenceNumber)

Returns an access condition such that an operation will be performed only if resource's current sequence number is equal to the specified value. This condition only applies to page blobs.

Parameters:

sequenceNumber - The value to compare to the current sequence number.

Returns:

An AccessCondition object that represents the If-Sequence-Number-EQ condition.

generateIfSequenceNumberLessThanCondition

public static AccessCondition generateIfSequenceNumberLessThanCondition(long sequenceNumber)

Returns an access condition such that an operation will be performed only if resource's current sequence number is less than the specified value. This condition only applies to page blobs.

Parameters:

sequenceNumber - The value to compare to the current sequence number.

Returns:

An AccessCondition object that represents the If-Sequence-Number-LT condition.

generateIfSequenceNumberLessThanOrEqualCondition

public static AccessCondition generateIfSequenceNumberLessThanOrEqualCondition(long sequenceNumber)

Returns an access condition such that an operation will be performed only if resource's current sequence number is less than or equal to the specified value. This condition only applies to page blobs.

Parameters:

sequenceNumber - The value to compare to the current sequence number.

Returns:

An AccessCondition object that represents the If-Sequence-Number-LE condition.

generateLeaseCondition

public static AccessCondition generateLeaseCondition(final String leaseID)

Returns an access condition such that an operation will be performed only if the resource is accessible under the specified lease ID.

For more information, see Specifying Conditional Headers for Blob Service Operations.

Parameters:

leaseID - The lease ID to specify.

Returns:

An AccessCondition object that represents the lease condition.

getIfAppendPositionEqual

public Long getIfAppendPositionEqual()

Gets the value for a conditional header used only for append operations. A number indicating the byte offset to check for. The append will succeed only if the end position is equal to this number.

Returns:

The append position number, or null if no condition exists.

getIfMatch

public String getIfMatch()

Gets the ETag when the If-Match condition is set.

Returns:

The ETag when the If-Match condition is set; otherwise, null.

getIfMaxSizeLessThanOrEqual

public Long getIfMaxSizeLessThanOrEqual()

Gets the value for a conditional header used only for append operations. A number that indicates the maximum length in bytes to restrict the blob to when committing the block.

Returns:

The maximum size, or null if no condition exists.

getIfModifiedSinceDate

public Date getIfModifiedSinceDate()

Gets the If-Modified-Since date.

Returns:

A java.util.Date object that represents the If-Modified-Since date.

getIfNoneMatch

public String getIfNoneMatch()

Gets the ETag when the If-None-Match condition is set.

Returns:

The ETag when the If-None-Match condition is set; otherwise, null.

getIfSequenceNumberEqual

public Long getIfSequenceNumberEqual()

Gets the sequence number when the sequence number equal condition is set. This condition is only applicable to page blobs.

Returns:

The sequence number when the ifSequenceNumberEqual condition is set; otherwise, null

getIfSequenceNumberLessThan

public Long getIfSequenceNumberLessThan()

Gets the sequence number when the sequence number less than condition is set. This condition is only applicable to page blobs.

Returns:

The sequence number when the ifSequenceNumberLessThan condition is set; otherwise, null

getIfSequenceNumberLessThanOrEqual

public Long getIfSequenceNumberLessThanOrEqual()

Gets the sequence number when the sequence number less than or equal condition is set. This condition is only applicable to page blobs.

Returns:

The sequence number when the ifSequenceNumberLessThanOrEqual condition is set; otherwise, null

getIfUnmodifiedSinceDate

public Date getIfUnmodifiedSinceDate()

Gets the If-Unmodified-Since date.

Returns:

A java.util.Date object that represents the If-Unmodified-Since date.

getLeaseID

public String getLeaseID()

Gets the lease ID.

Returns:

The lease ID.

setIfAppendPositionEqual

public void setIfAppendPositionEqual(Long ifAppendPositionEqual)

Sets the value for a conditional header used only for append operations. A number indicating the byte offset to check for. The append will succeed only if the end position is equal to this number.

Parameters:

ifAppendPositionEqual - The append position number, or null if no condition exists.

setIfMatch

public void setIfMatch(String etag)

Sets the ETag for the If-Match condition.

Parameters:

etag - The ETag to set for the If-Match condition.

setIfMaxSizeLessThanOrEqual

public void setIfMaxSizeLessThanOrEqual(Long ifMaxSizeLessThanOrEqual)

Sets the value for a conditional header used only for append operations. A number that indicates the maximum length in bytes to restrict the blob to when committing the block.

Parameters:

ifMaxSizeLessThanOrEqual - The maximum size, or null if no condition exists.

setIfModifiedSinceDate

public void setIfModifiedSinceDate(Date ifModifiedSinceDate)

Sets the If-Modified-Since date.

Parameters:

ifModifiedSinceDate - A java.util.Date object that represents the If-Modified-Since to set.

setIfNoneMatch

public void setIfNoneMatch(String etag)

Sets the ETag for the If-None-Match condition.

Parameters:

etag - The ETag to set for the If-None-Match condition.

setIfSequenceNumberEqual

public void setIfSequenceNumberEqual(Long sequenceNumber)

Sets the sequence number for the sequence number equal to condition. This condition is only applicable to page blobs.

Parameters:

sequenceNumber - The sequence number to set the if sequence number equal condition to.

setIfSequenceNumberLessThan

public void setIfSequenceNumberLessThan(Long sequenceNumber)

Sets the sequence number for the sequence number less than condition. This condition is only applicable to page blobs.

Parameters:

sequenceNumber - The sequence number to set the if sequence number less than condition to.

setIfSequenceNumberLessThanOrEqual

public void setIfSequenceNumberLessThanOrEqual(Long sequenceNumber)

Sets the sequence number for the sequence number less than or equal to condition. This condition is only applicable to page blobs.

Parameters:

sequenceNumber - The sequence number to set the if sequence number less than or equal condition to.

setIfUnmodifiedSinceDate

public void setIfUnmodifiedSinceDate(Date ifUnmodifiedSinceDate)

Sets the If-Unmodified-Since date.

Parameters:

ifUnmodifiedSinceDate - A java.util.Date object that represents the If-Unmodified-Since to set.

setLeaseID

public void setLeaseID(String leaseID)

Gets the lease ID.

Parameters:

leaseID - The lease ID to set.

verifyConditional

public boolean verifyConditional(final String etag, final Date lastModified)

RESERVED FOR INTERNAL USE. Verifies the condition is satisfied.

Parameters:

etag - A String that represents the ETag to check.
lastModified - A java.util.Date object that represents the last modified date/time.

Returns:

true if the condition is satisfied; otherwise, false.

Applies to