Package org.opensearch.core.common.unit
Class ByteSizeValue
java.lang.Object
org.opensearch.core.common.unit.ByteSizeValue
- All Implemented Interfaces:
Comparable<ByteSizeValue>,Writeable,ToXContent,ToXContentFragment
@PublicApi(since="1.0.0")
public class ByteSizeValue
extends Object
implements Writeable, Comparable<ByteSizeValue>, ToXContentFragment
A byte size value
- Opensearch.api:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opensearch.core.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.ParamsNested classes/interfaces inherited from interface org.opensearch.core.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.WriteableRegistry, Writeable.Writer<V> -
Field Summary
FieldsFields inherited from interface org.opensearch.core.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintDeprecated.intcompareTo(ByteSizeValue other) booleanlonggetBytes()longgetGb()doublelonggetKb()doublelonggetMb()doublelonggetPb()doublelonggetTb()doubleinthashCode()static ByteSizeValueparseBytesSizeValue(String sValue, String settingName) static ByteSizeValueparseBytesSizeValue(String sValue, ByteSizeValue defaultValue, String settingName) toString()toXContent(XContentBuilder builder, ToXContent.Params params) voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opensearch.core.xcontent.ToXContentFragment
isFragment
-
Field Details
-
ZERO
-
-
Constructor Details
-
ByteSizeValue
- Throws:
IOException
-
ByteSizeValue
public ByteSizeValue(long bytes) -
ByteSizeValue
-
-
Method Details
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
bytesAsInt
Deprecated. -
getBytes
public long getBytes() -
getKb
public long getKb() -
getMb
public long getMb() -
getGb
public long getGb() -
getTb
public long getTb() -
getPb
public long getPb() -
getKbFrac
public double getKbFrac() -
getMbFrac
public double getMbFrac() -
getGbFrac
public double getGbFrac() -
getTbFrac
public double getTbFrac() -
getPbFrac
public double getPbFrac() -
getStringRep
- Returns:
- a string representation of this value which is guaranteed to be
able to be parsed using
parseBytesSizeValue(String, ByteSizeValue, String). UnliketoString()this method will not output fractional or rounded values so this method should be preferred when serialising the value to JSON.
-
toString
-
parseBytesSizeValue
public static ByteSizeValue parseBytesSizeValue(String sValue, String settingName) throws OpenSearchParseException - Throws:
OpenSearchParseException
-
parseBytesSizeValue
public static ByteSizeValue parseBytesSizeValue(String sValue, ByteSizeValue defaultValue, String settingName) throws OpenSearchParseException - Throws:
OpenSearchParseException
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareToin interfaceComparable<ByteSizeValue>
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceToXContent- Throws:
IOException
-