org.apache.ode.daohib.bpel.hobj

## Class GZipDataType

- java.lang.Object
- - org.apache.ode.daohib.bpel.hobj.GZipDataType

- All Implemented Interfaces:
    org.hibernate.usertype.UserType

      public class GZipDataType
      extends java.lang.Object
      implements org.hibernate.usertype.UserType

  Custom Hibernate datatype that compresses (GZip) byte arrays to increase performance and save disk space.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static byte[]` | `GZIP_PREFIX` For backward compatibility with non-zipped data, prefix the gzip stream with a magic sequence
    `static java.lang.Class` | `RETURNED_CLASS`
    `static int[]` | `SQL_TYPES`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GZipDataType()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `assemble(java.io.Serializable cached, java.lang.Object owner)` Reconstruct an object from the cacheable representation
    `java.lang.Object` | `deepCopy(java.lang.Object value)` Return a deep copy of the persistent state
    `java.io.Serializable` | `disassemble(java.lang.Object value)` Transform the object into its cacheable representation
    `boolean` | `equals(java.lang.Object x, java.lang.Object y)` Compare two instances of the class mapped by this type for persistence "equality".
    `static byte[]` | `gunzip(java.io.InputStream input)` Decompress (using gzip algorithm) a byte array.
    `static void` | `gzip(byte[] content, java.io.OutputStream out)` Compress (using gzip algorithm) a byte array into an output stream.
    `int` | `hashCode(java.lang.Object x)` Get a hashcode for the instance, consistent with persistence "equality"
    `boolean` | `isMutable()` Are objects of this type mutable?
    `java.lang.Object` | `nullSafeGet(java.sql.ResultSet rs, java.lang.String[] names, java.lang.Object owner)` Retrieve an instance of the mapped class from a JDBC resultset.
    `void` | `nullSafeSet(java.sql.PreparedStatement st, java.lang.Object value, int index)` Write an instance of the mapped class to a prepared statement.
    `java.lang.Object` | `replace(java.lang.Object original, java.lang.Object target, java.lang.Object owner)` During merge, replace the existing (target) value in the entity we are merging to with a new (original) value from the detached entity we are merging.
    `java.lang.Class` | `returnedClass()` The class returned by nullSafeGet().
    `int[]` | `sqlTypes()` Return the SQL type codes for the columns mapped by this type.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### SQL_TYPES

          public static final int[] SQL_TYPES

    - #### RETURNED_CLASS

          public static final java.lang.Class RETURNED_CLASS

    - #### GZIP_PREFIX

          public static final byte[] GZIP_PREFIX

      For backward compatibility with non-zipped data, prefix the gzip stream with a magic sequence

  - ### Constructor Detail

    - #### GZipDataType

          public GZipDataType()

  - ### Method Detail

    - #### assemble

          public java.lang.Object assemble(java.io.Serializable cached,
                                  java.lang.Object owner)

      Reconstruct an object from the cacheable representation
      Specified by:
        `assemble` in interface `org.hibernate.usertype.UserType`

    - #### disassemble

          public java.io.Serializable disassemble(java.lang.Object value)

      Transform the object into its cacheable representation
      Specified by:
        `disassemble` in interface `org.hibernate.usertype.UserType`

    - #### deepCopy

          public java.lang.Object deepCopy(java.lang.Object value)

      Return a deep copy of the persistent state
      Specified by:
        `deepCopy` in interface `org.hibernate.usertype.UserType`

    - #### equals

          public boolean equals(java.lang.Object x,
                       java.lang.Object y)

      Compare two instances of the class mapped by this type for persistence "equality".
      Specified by:
        `equals` in interface `org.hibernate.usertype.UserType`

    - #### hashCode

          public int hashCode(java.lang.Object x)

      Get a hashcode for the instance, consistent with persistence "equality"
      Specified by:
        `hashCode` in interface `org.hibernate.usertype.UserType`

    - #### isMutable

          public boolean isMutable()

      Are objects of this type mutable?
      Specified by:
        `isMutable` in interface `org.hibernate.usertype.UserType`

    - #### nullSafeGet

          public java.lang.Object nullSafeGet(java.sql.ResultSet rs,
                                     java.lang.String[] names,
                                     java.lang.Object owner)
                                       throws java.sql.SQLException

      Retrieve an instance of the mapped class from a JDBC resultset.
      Specified by:
        `nullSafeGet` in interface `org.hibernate.usertype.UserType`
      Throws:
        `java.sql.SQLException`

    - #### nullSafeSet

          public void nullSafeSet(java.sql.PreparedStatement st,
                         java.lang.Object value,
                         int index)
                           throws java.sql.SQLException

      Write an instance of the mapped class to a prepared statement.
      Specified by:
        `nullSafeSet` in interface `org.hibernate.usertype.UserType`
      Throws:
        `java.sql.SQLException`

    - #### replace

          public java.lang.Object replace(java.lang.Object original,
                                 java.lang.Object target,
                                 java.lang.Object owner)

      During merge, replace the existing (target) value in the entity we are merging to with a new (original) value from the detached entity we are merging.
      Specified by:
        `replace` in interface `org.hibernate.usertype.UserType`

    - #### returnedClass

          public java.lang.Class returnedClass()

      The class returned by nullSafeGet().
      Specified by:
        `returnedClass` in interface `org.hibernate.usertype.UserType`

    - #### sqlTypes

          public int[] sqlTypes()

      Return the SQL type codes for the columns mapped by this type.
      Specified by:
        `sqlTypes` in interface `org.hibernate.usertype.UserType`

    - #### gzip

          public static void gzip(byte[] content,
                  java.io.OutputStream out)

      Compress (using gzip algorithm) a byte array into an output stream.

    - #### gunzip

          public static byte[] gunzip(java.io.InputStream input)

      Decompress (using gzip algorithm) a byte array.