Interface ByteSizeParser
- All Known Implementing Classes:
ByteSizeParser.Default
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ByteSizeParser
Parser for
ByteSizes out of textual representation.-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classByteSizeParser.Default -
Method Summary
Modifier and Type Method Description static ByteSizeParserNew()Preudo-constructor method to create a newByteSizeParser.static ByteSizeParserNew(ByteUnit defaultUnit)Preudo-constructor method to create a newByteSizeParser.ByteSizeparse(String text)Tries to parse aByteSizeout oftext.
-
Method Details
-
parse
Tries to parse aByteSizeout oftext. It usually consists of an amount and an unit, e.g."1MB"or"1.2 GB".- Parameters:
text- the textual input- Returns:
- the parsed
ByteSize - Throws:
IllegalArgumentException- if the text couldn't be parsed to aByteSize- See Also:
ByteSize,ByteUnit
-
New
Preudo-constructor method to create a newByteSizeParser.- Returns:
- a new
ByteSizeParser
-
New
Preudo-constructor method to create a newByteSizeParser.- Parameters:
defaultUnit- the default unit which is used if no unit is given in the input- Returns:
- a new
ByteSizeParser
-