org.silverpeas.util.memory
Class MemoryData

java.lang.Object
  extended by org.silverpeas.util.memory.MemoryData

public class MemoryData
extends Object

User: Yohann Chastagnier Date: 14/11/13


Constructor Summary
MemoryData(BigDecimal byteSize)
          Hidden constructor
MemoryData(long byteSize)
          Hidden constructor
 
Method Summary
static BigDecimal convertTo(BigDecimal value, MemoryUnit from, MemoryUnit to)
          Converting a computer data storage value
 String getBestDisplayValue()
          Gets the best display value
 String getBestDisplayValueOnly()
          Gets the best display value
 MemoryUnit getBestUnit()
          Gets the best unit (for display as example).
 BigDecimal getBestValue()
          Gets the best unformatted value (for display as example).
 String getFormattedValue(MemoryUnit to)
          Gets the desired value with its label
 String getFormattedValueOnly(MemoryUnit to)
          Gets the desired value only
 BigDecimal getRoundedSizeConverted(MemoryUnit to)
          Gets the size converted to desired unit.
 BigDecimal getSize()
          Gets the size in bytes.
 Long getSizeAsLong()
          Gets the size in bytes.
 BigDecimal getSizeConverted(MemoryUnit to)
          Gets the size converted to desired unit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryData

public MemoryData(long byteSize)
Hidden constructor

Parameters:
byteSize -

MemoryData

public MemoryData(BigDecimal byteSize)
Hidden constructor

Parameters:
byteSize -
Method Detail

convertTo

public static BigDecimal convertTo(BigDecimal value,
                                   MemoryUnit from,
                                   MemoryUnit to)
Converting a computer data storage value

Parameters:
value -
from -
to -
Returns:

getSize

public BigDecimal getSize()
Gets the size in bytes.

Returns:

getSizeAsLong

public Long getSizeAsLong()
Gets the size in bytes.

Returns:
a long value.

getRoundedSizeConverted

public BigDecimal getRoundedSizeConverted(MemoryUnit to)
Gets the size converted to desired unit.

Parameters:
to -
Returns:

getSizeConverted

public BigDecimal getSizeConverted(MemoryUnit to)
Gets the size converted to desired unit.

Parameters:
to -
Returns:

getBestUnit

public MemoryUnit getBestUnit()
Gets the best unit (for display as example).

Returns:

getBestValue

public BigDecimal getBestValue()
Gets the best unformatted value (for display as example).

Returns:

getBestDisplayValueOnly

public String getBestDisplayValueOnly()
Gets the best display value

Returns:

getBestDisplayValue

public String getBestDisplayValue()
Gets the best display value

Returns:

getFormattedValueOnly

public String getFormattedValueOnly(MemoryUnit to)
Gets the desired value only

Returns:

getFormattedValue

public String getFormattedValue(MemoryUnit to)
Gets the desired value with its label

Returns:


Copyright © 2016 Silverpeas. All Rights Reserved.