Package org.elasticsearch.common.unit
Class ByteSizeValue
java.lang.Object
org.elasticsearch.common.unit.ByteSizeValue
- All Implemented Interfaces:
Comparable<ByteSizeValue>,Writeable,org.elasticsearch.common.xcontent.ToXContent,org.elasticsearch.common.xcontent.ToXContentFragment
public class ByteSizeValue
extends Object
implements Writeable, Comparable<ByteSizeValue>, org.elasticsearch.common.xcontent.ToXContentFragment
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
FieldsFields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintDeprecated.intcompareTo(ByteSizeValue other)booleanlonggetBytes()longgetGb()doublelonggetKb()doublelonggetMb()doublelonggetPb()doublelonggetTb()doubleinthashCode()static ByteSizeValueofBytes(long size)static ByteSizeValueofGb(long size)static ByteSizeValueofKb(long size)static ByteSizeValueofMb(long size)static ByteSizeValueofPb(long size)static ByteSizeValueofTb(long size)static ByteSizeValueparseBytesSizeValue(String sValue, String settingName)static ByteSizeValueparseBytesSizeValue(String sValue, ByteSizeValue defaultValue, String settingName)toString()org.elasticsearch.common.xcontent.XContentBuildertoXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.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.elasticsearch.common.xcontent.ToXContentFragment
isFragment
-
Field Details
-
ZERO
-
-
Constructor Details
-
ByteSizeValue
- Throws:
IOException
-
ByteSizeValue
public ByteSizeValue(long bytes) -
ByteSizeValue
-
-
Method Details
-
ofBytes
-
ofKb
-
ofMb
-
ofGb
-
ofTb
-
ofPb
-
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 ElasticsearchParseException- Throws:
ElasticsearchParseException
-
parseBytesSizeValue
public static ByteSizeValue parseBytesSizeValue(String sValue, ByteSizeValue defaultValue, String settingName) throws ElasticsearchParseException- Throws:
ElasticsearchParseException
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareToin interfaceComparable<ByteSizeValue>
-
toXContent
public org.elasticsearch.common.xcontent.XContentBuilder toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws IOException- Specified by:
toXContentin interfaceorg.elasticsearch.common.xcontent.ToXContent- Throws:
IOException
-