Interface DescriptorSerializer<B extends Descriptor>

Type Parameters:
B - Represented bare descriptor type. Note that rich descriptor type is not referenced in this level. Rich descriptor type is only introduced by the implementations.
All Superinterfaces:
Guarded, Serializable
All Known Subinterfaces:
BvGenerator, CfpGenerator, DescriptorGenerator<B>, EcfpGenerator, FvGenerator, PfGenerator
All Known Implementing Classes:
AbstractShapeGenerator

@Beta @PublicAPI public interface DescriptorSerializer<B extends Descriptor> extends Serializable, Guarded
DescriptorSerializer represents descriptor IO.

IO preserves the data represented by the descriptors bare form. The additional details possibly represented by the rich form are not preserved during serialization; so deserialization is possible only into the bare form. Note that it is possible for a DescriptorGenerator to not distinguish between rich and bare descriptors.

Note that object serialization must preserve guard objects returned by Guarded.getGuardObject().

Note that serialization does not preserve the guard object reference. It is an external API contract to ensure that deserialization is fed only data from a compatible representation.

Please note that this interface is marked with Beta annotation, so it can be subject of incompatible changes or removal in later releases.

  • Method Details

    • toByteArray

      byte[] toByteArray(B desc)
      Creates the byte array representation of a descriptor object.

      Note that implementations of this method must ensure the matching of associated guard objects.

      The descriptors bare form can be reconstructed using fromByteArray(byte[]).

      Parameters:
      desc - Descriptor (only bare form is considered)
      Returns:
      Byte array representation of the descriptor
    • toString

      String toString(B desc)
      Creates the String representation of a descriptor object.

      The descriptors bare form can be reconstructed using fromString(java.lang.String).

      Parameters:
      desc - Descriptor (only bare form is considered)
      Returns:
      String representation of descriptor
    • fromString

      B fromString(String desc)
      Builds a descriptor from its string representation.

      Please note that the compatibility of this (the reconstructing) DescriptorGenerator, regarding to the serializing generator (on which toString(com.chemaxon.descriptors.common.Descriptor) was called to construct the String form) is not checked; compatibility must be ensured by the user application.

      Parameters:
      desc - String representation
      Returns:
      Reconstructed descriptors bare form
    • fromByteArray

      B fromByteArray(byte[] desc)
      Builds a descriptor from its byte array representation.

      Please note that the compatibility of this (the reconstructing) DescriptorGenerator, regarding to the serializing generator (on which toByteArray(com.chemaxon.descriptors.common.Descriptor) was called to construct the byte array form) is not checked; compatibility must be ensured by the user application.

      Parameters:
      desc - Byte array of the descriptor
      Returns:
      Reconstructed descriptors bare form
    • serializerIsEqualWith

      boolean serializerIsEqualWith(DescriptorSerializer<?> other)
      Check strict equivalence of serializers.

      Implementations are expected to be symmetric and transitive.

      Parameters:
      other - Other serializer
      Returns:
      true when and only when the two serializers (this and other) are the same thus interchangeable. Implementations typically check class equivalence, guard object match and parameter match.