Interface Serialization
- All Known Implementing Classes:
DefaultSerializationExceptionWrapper
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 TypeMethodDescriptiondeserialize(URL url, InputStream input) Get a deserialization implementation instanceGet content typebyteGet content type unique id, recommended that custom implementations use values different with any value ofConstantsand 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 ofConstantsand 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
Get a serialization implementation instance- Parameters:
url- URL address for the remote serviceoutput- the underlying output stream- Returns:
- serializer
- Throws:
IOException
-
deserialize
Get a deserialization implementation instance- Parameters:
url- URL address for the remote serviceinput- the underlying input stream- Returns:
- deserializer
- Throws:
IOException
-