Class 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 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.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • 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.