Package de.xima.fc.mdl
Class LargeString
- java.lang.Object
-
- de.xima.fc.mdl.LargeString
-
- All Implemented Interfaces:
Serializable
public final class LargeString extends Object implements Serializable
Wrapper for reading a string lazily, e.g. from a file.- Since:
- 7.2.1
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LargeString(ISerializableSupplier<String> supplier)
A new large string that reads the data from the given supplier.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LargeString
empty()
boolean
equals(Object obj)
String
getData()
int
hashCode()
static LargeString
ofFile(File file, Charset charset)
static LargeString
ofFileAsBase64String(File file)
static LargeString
ofFileAsDataUri(String mimeType, File file)
static LargeString
ofValue(String value)
String
toString()
-
-
-
Constructor Detail
-
LargeString
public LargeString(ISerializableSupplier<String> supplier)
A new large string that reads the data from the given supplier.- Parameters:
supplier
- Supplier for accessing the data when necessary.
-
-
Method Detail
-
getData
public String getData()
- Returns:
- The data encapsulated by this large string instance.
-
empty
public static LargeString empty()
- Returns:
- A large string with no data.
-
ofFile
public static LargeString ofFile(File file, Charset charset)
- Parameters:
file
- File with the data.charset
- Charset to use for reading the data.- Returns:
- A large string with the data of the given file.
-
ofFileAsBase64String
public static LargeString ofFileAsBase64String(File file)
- Parameters:
file
- File with the data.- Returns:
- A large string with the data of the given file as a base 64 string.
-
ofFileAsDataUri
public static LargeString ofFileAsDataUri(String mimeType, File file)
- Parameters:
mimeType
- Mime type of the file.file
- File with the data.- Returns:
- A large string with the data of the given file as a data URI.
-
ofValue
public static LargeString ofValue(String value)
- Parameters:
value
- Value to wrap.- Returns:
- A large string with the given data.
-
-