Package org.elasticsearch.common.unit
Class ByteSizeValue
java.lang.Object
org.elasticsearch.common.unit.ByteSizeValue
- All Implemented Interfaces:
java.lang.Comparable<ByteSizeValue>
,Writeable
,ToXContent
,ToXContentFragment
public class ByteSizeValue extends java.lang.Object implements Writeable, java.lang.Comparable<ByteSizeValue>, ToXContentFragment
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields Modifier and Type Field Description static ByteSizeValue
ZERO
-
Constructor Summary
Constructors Constructor Description ByteSizeValue(long bytes)
ByteSizeValue(long size, ByteSizeUnit unit)
ByteSizeValue(StreamInput in)
-
Method Summary
Modifier and Type Method Description int
bytesAsInt()
Deprecated.int
compareTo(ByteSizeValue other)
boolean
equals(java.lang.Object o)
long
getBytes()
long
getGb()
double
getGbFrac()
long
getKb()
double
getKbFrac()
long
getMb()
double
getMbFrac()
long
getPb()
double
getPbFrac()
java.lang.String
getStringRep()
long
getTb()
double
getTbFrac()
int
hashCode()
static ByteSizeValue
parseBytesSizeValue(java.lang.String sValue, java.lang.String settingName)
static ByteSizeValue
parseBytesSizeValue(java.lang.String sValue, ByteSizeValue defaultValue, java.lang.String settingName)
java.lang.String
toString()
XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.
-
Field Details
-
Constructor Details
-
ByteSizeValue
- Throws:
java.io.IOException
-
ByteSizeValue
public ByteSizeValue(long bytes) -
ByteSizeValue
-
-
Method Details
-
writeTo
Description copied from interface:Writeable
Write this into the StreamOutput. -
bytesAsInt
@Deprecated public int 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
public java.lang.String 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
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
parseBytesSizeValue
public static ByteSizeValue parseBytesSizeValue(java.lang.String sValue, java.lang.String settingName) throws ElasticsearchParseException- Throws:
ElasticsearchParseException
-
parseBytesSizeValue
public static ByteSizeValue parseBytesSizeValue(java.lang.String sValue, ByteSizeValue defaultValue, java.lang.String settingName) throws ElasticsearchParseException- Throws:
ElasticsearchParseException
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
compareTo
- Specified by:
compareTo
in interfacejava.lang.Comparable<ByteSizeValue>
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-