Package ch.qos.logback.core.util
Class FileSize
- java.lang.Object
-
- ch.qos.logback.core.util.FileSize
-
public class FileSize extends java.lang.ObjectInstances of this class represent the size of a file. Internally, the size is stored as long.>The
valueOf(java.lang.String)method can convert strings such as "3 kb", "5 mb", into FileSize instances. The recognized unit specifications for file size are the "kb", "mb", and "gb". The unit name may be followed by an "s". Thus, "2 kbs" and "2 kb" are equivalent. In the absence of a time unit specification, byte is assumed.
-
-
Field Summary
Fields Modifier and Type Field Description private static intDOUBLE_GROUPprivate static java.util.regex.PatternFILE_SIZE_PATTERNstatic longGB_COEFFICIENTstatic longKB_COEFFICIENTprivate static java.lang.StringLENGTH_PARTstatic longMB_COEFFICIENT(package private) longsizeprivate static intUNIT_GROUPprivate static java.lang.StringUNIT_PART
-
Constructor Summary
Constructors Constructor Description FileSize(long size)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetSize()java.lang.StringtoString()static FileSizevalueOf(java.lang.String fileSizeStr)
-
-
-
Field Detail
-
LENGTH_PART
private static final java.lang.String LENGTH_PART
- See Also:
- Constant Field Values
-
DOUBLE_GROUP
private static final int DOUBLE_GROUP
- See Also:
- Constant Field Values
-
UNIT_PART
private static final java.lang.String UNIT_PART
- See Also:
- Constant Field Values
-
UNIT_GROUP
private static final int UNIT_GROUP
- See Also:
- Constant Field Values
-
FILE_SIZE_PATTERN
private static final java.util.regex.Pattern FILE_SIZE_PATTERN
-
KB_COEFFICIENT
public static final long KB_COEFFICIENT
- See Also:
- Constant Field Values
-
MB_COEFFICIENT
public static final long MB_COEFFICIENT
- See Also:
- Constant Field Values
-
GB_COEFFICIENT
public static final long GB_COEFFICIENT
- See Also:
- Constant Field Values
-
size
final long size
-
-
Method Detail
-
getSize
public long getSize()
-
valueOf
public static FileSize valueOf(java.lang.String fileSizeStr)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-