Class Blobs


  • public final class Blobs
    extends Object
    Contains factory methods to create various types of blobs.
    • Method Detail

      • createBlob

        public static Blob createBlob​(byte[] data)
        Create a blob from a byte array.
        Parameters:
        data - the byte array
        Returns:
        the blob
      • createMemoryBlob

        public static MemoryBlob createMemoryBlob()
        Create a MemoryBlob instance.
        Returns:
        the blob
      • createOverflowableBlob

        public static OverflowableBlob createOverflowableBlob​(int threshold,
                                                              WritableBlobFactory<?> overflowBlobFactory)
        Create an OverflowableBlob.
        Parameters:
        threshold - the threshold above which data is transferred to the overflow blob
        overflowBlobFactory - the factory that will be used to create the overflow blob
        Returns:
        the blob
      • createOverflowableBlob

        public static OverflowableBlob createOverflowableBlob​(int threshold,
                                                              String tempPrefix,
                                                              String tempSuffix,
                                                              File tempDirectory)
        Create an OverflowableBlob that overflows to a temporary file. Temporary files are created using File.createTempFile(String, String, File).
        Parameters:
        threshold - the overflow threshold
        tempPrefix - the prefix to be used in generating the name of the temporary file
        tempSuffix - the suffix to be used in generating the name of the temporary file
        tempDirectory - the directory in which the temporary file is to be created, or null if the default temporary directory is to be used
        Returns:
        the blob