Class Binary.BinaryString

java.lang.Object
org.rapidcontext.core.data.Binary.BinaryString
All Implemented Interfaces:
Binary
Enclosing interface:
Binary

public static class Binary.BinaryString extends Object implements Binary
A binary data object, encapsulating a string.
Version:
1.0
  • Constructor Details

    • BinaryString

      public BinaryString(String data)
      Creates a new binary string wrapper.
      Parameters:
      data - the string to encapsulate
  • Method Details

    • size

      public long size()
      Returns the size (in bytes) of the binary object, if known.
      Specified by:
      size in interface Binary
      Returns:
      the object size (in bytes), or -1 if unknown
    • lastModified

      public long lastModified()
      The last modified timestamp for the object, if known.
      Specified by:
      lastModified in interface Binary
      Returns:
      the last modified timestamp, or zero (0) or the current system if unknown
    • mimeType

      public String mimeType()
      The MIME type of the binary data. Use a standard opaque binary data MIME type or one based on requested file name if unknown.
      Specified by:
      mimeType in interface Binary
      Returns:
      the MIME type of the binary data
    • sha256

      public String sha256()
      The SHA-256 of the binary data, if known.
      Specified by:
      sha256 in interface Binary
      Returns:
      the hexadecimal string with the SHA-256 hash, or null if not available
    • openStream

      public InputStream openStream() throws IOException
      Opens a new input stream for reading the data. Note that this method SHOULD be possible to call several times.
      Specified by:
      openStream in interface Binary
      Returns:
      a new input stream for reading the binary data
      Throws:
      IOException - if the data couldn't be opened for reading