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.Params
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
Field Summary
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Deprecated.int
compareTo(ByteSizeValue other)
boolean
long
getBytes()
long
getGb()
double
long
getKb()
double
long
getMb()
double
long
getPb()
double
long
getTb()
double
int
hashCode()
static ByteSizeValue
ofBytes(long size)
static ByteSizeValue
ofGb(long size)
static ByteSizeValue
ofKb(long size)
static ByteSizeValue
ofMb(long size)
static ByteSizeValue
ofPb(long size)
static ByteSizeValue
ofTb(long size)
static ByteSizeValue
parseBytesSizeValue(String sValue, String settingName)
static ByteSizeValue
parseBytesSizeValue(String sValue, ByteSizeValue defaultValue, String settingName)
toString()
org.elasticsearch.common.xcontent.XContentBuilder
toXContent(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)
void
writeTo(StreamOutput out)
Write this into the StreamOutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:Writeable
Write this into the StreamOutput.- Specified by:
writeTo
in 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:
compareTo
in 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:
toXContent
in interfaceorg.elasticsearch.common.xcontent.ToXContent
- Throws:
IOException
-