Interface Serialization

All Known Implementing Classes:
DefaultSerializationExceptionWrapper

@SPI(scope=FRAMEWORK) public interface Serialization
Serialization strategy interface that specifies a serializer. (SPI, Singleton, ThreadSafe) The default extension is hessian2 and the default serialization implementation of the dubbo protocol.
     e.g. <dubbo:protocol serialization="xxx" />
 
  • Method Summary

    Modifier and Type
    Method
    Description
    Get a deserialization implementation instance
    Get content type
    byte
    Get content type unique id, recommended that custom implementations use values different with any value of Constants and don't greater than ExchangeCodec.SERIALIZATION_MASK (31) because dubbo protocol use 5 bits to record serialization ID in header.
    serialize(URL url, OutputStream output)
    Get a serialization implementation instance
  • Method Details

    • getContentTypeId

      byte getContentTypeId()
      Get content type unique id, recommended that custom implementations use values different with any value of Constants and don't greater than ExchangeCodec.SERIALIZATION_MASK (31) because dubbo protocol use 5 bits to record serialization ID in header.
      Returns:
      content type id
    • getContentType

      String getContentType()
      Get content type
      Returns:
      content type
    • serialize

      @Adaptive ObjectOutput serialize(URL url, OutputStream output) throws IOException
      Get a serialization implementation instance
      Parameters:
      url - URL address for the remote service
      output - the underlying output stream
      Returns:
      serializer
      Throws:
      IOException
    • deserialize

      @Adaptive ObjectInput deserialize(URL url, InputStream input) throws IOException
      Get a deserialization implementation instance
      Parameters:
      url - URL address for the remote service
      input - the underlying input stream
      Returns:
      deserializer
      Throws:
      IOException