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:
  • Constructor Details

    • 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 Details

    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getData

      public String getData()
      Returns:
      The data encapsulated by this large string instance.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • empty

      public static LargeString empty()
      Returns:
      A large string with no data.
    • ofByteArray

      public static LargeString ofByteArray(byte[] data, Charset charset)
      Parameters:
      data - Binary data.
      charset - Charset to use.
      Returns:
      A large string with the given 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.