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
ByteSize
s out of textual representation.-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ByteSizeParser.Default
-
Method Summary
Modifier and Type Method Description static ByteSizeParser
New()
Preudo-constructor method to create a newByteSizeParser
.static ByteSizeParser
New(ByteUnit defaultUnit)
Preudo-constructor method to create a newByteSizeParser
.ByteSize
parse(String text)
Tries to parse aByteSize
out oftext
.
-
Method Details
-
parse
Tries to parse aByteSize
out 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
-