Class BlobImpl

    • Constructor Detail

      • BlobImpl

        public BlobImpl()
      • BlobImpl

        public BlobImpl​(InputStreamFactory streamFactory)
        Creates a MMBlob object with the valueID.
        Parameters:
        streamFactory - reference to value chunk in data source.
    • Method Detail

      • getBytes

        public byte[] getBytes​(long pos,
                               int length)
                        throws SQLException
        Returns as an array of bytes, part or all of the BLOB value that this Blob object designates. The byte array contains up to length consecutive bytes starting at position pos.
        Specified by:
        getBytes in interface Blob
        Parameters:
        pos - the ordinal position of the first byte in the BLOB value to be extracted; the first byte is at position 1
        length - the number of consecutive bytes to be copied
        Returns:
        a byte array containing up to length consecutive bytes from the BLOB value designated by this Blob object, starting with the byte at position pos
        Throws:
        SQLException - if there is an error accessing the BLOB
      • position

        public long position​(Blob pattern,
                             long start)
                      throws SQLException
        Determines the byte position in the BLOB value designated by this Blob object at which pattern begins. The search begins at position start.
        Specified by:
        position in interface Blob
        Parameters:
        pattern - the Blob object designating the BLOB value for which to search
        start - the position in the BLOB value at which to begin searching; the first position is 1
        Returns:
        the position at which the pattern begins, else -1
        Throws:
        SQLException - if there is an error accessing the BLOB
      • position

        public long position​(byte[] pattern,
                             long start)
                      throws SQLException
        Determines the byte position at which the specified byte pattern begins within the BLOB value that this Blob object represents. The search for pattern begins at position start.
        Specified by:
        position in interface Blob
        Parameters:
        pattern - the byte array for which to search
        start - the position at which to begin searching; the first position is 1
        Returns:
        the position at which the pattern appears, else -1
        Throws:
        SQLException - if there is an error accessing the BLOB
      • quickLength

        public static long quickLength​(Blob b)
        For a given blob try to determine the length without fully reading an inputstream
        Returns:
        the length or -1 if it cannot be determined