Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message encoder #43803

Draft
wants to merge 11 commits into
base: feature/storage/content-validation
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.storage.common;

/**
* Defines values for Flags.
*/
public enum Flags {
/**
* No flags set.
*/
NONE(0),

/**
* Flag indicating the use of CRC64.
*/
STORAGE_CRC64(1);

/**
* The actual serialized value for a Flags instance.
*/
private final int value;

Flags(int value) {
this.value = value;
}

/**
* Parses a serialized value to a Flags instance.
*
* @param value the serialized value to parse.
* @return the parsed Flags object, or null if unable to parse.
*/
public static Flags fromString(String value) {
if (value == null) {
return null;
}
Flags[] items = Flags.values();
for (Flags item : items) {
if (item.getValue() == Integer.parseInt(value)) {
return item;
}
}
return null;
}

/**
* Returns the value for a Flags instance.
*
* @return the integer value of the Flags object.
*/
public int getValue() {
return value;
}
}
Loading
Loading