public class ObjectSerializationCodecFactory extends Object implements ProtocolCodecFactory
ProtocolCodecFactory
that serializes and deserializes Java objects.
This codec is very useful when you have to prototype your application rapidly
without any specific codec.Constructor and Description |
---|
ObjectSerializationCodecFactory()
Creates a new instance with the
ClassLoader of
the current thread. |
ObjectSerializationCodecFactory(ClassLoader classLoader)
Creates a new instance with the specified
ClassLoader . |
Modifier and Type | Method and Description |
---|---|
void |
accept(ClassNameMatcher classNameMatcher)
Accept class names where the supplied ClassNameMatcher matches for
deserialization, unless they are otherwise rejected.
|
void |
accept(Pattern pattern)
Accept class names that match the supplied pattern for
deserialization, unless they are otherwise rejected.
|
void |
accept(String... patterns)
Accept the wildcard specified classes for deserialization,
unless they are otherwise rejected.
|
ProtocolDecoder |
getDecoder(IoSession session)
Returns a new (or reusable) instance of
ProtocolDecoder which
decodes binary or protocol-specific data into message objects. |
int |
getDecoderMaxObjectSize() |
ProtocolEncoder |
getEncoder(IoSession session)
Returns a new (or reusable) instance of
ProtocolEncoder which
encodes message objects into binary or protocol-specific data. |
int |
getEncoderMaxObjectSize() |
void |
setDecoderMaxObjectSize(int maxObjectSize)
Sets the allowed maximum size of the object to be decoded.
|
void |
setEncoderMaxObjectSize(int maxObjectSize)
Sets the allowed maximum size of the encoded object.
|
public ObjectSerializationCodecFactory()
ClassLoader
of
the current thread.public ObjectSerializationCodecFactory(ClassLoader classLoader)
ClassLoader
.classLoader
- The class loader to usepublic ProtocolEncoder getEncoder(IoSession session)
ProtocolEncoder
which
encodes message objects into binary or protocol-specific data.getEncoder
in interface ProtocolCodecFactory
session
- The current sessionpublic ProtocolDecoder getDecoder(IoSession session)
ProtocolDecoder
which
decodes binary or protocol-specific data into message objects.getDecoder
in interface ProtocolCodecFactory
session
- The current sessionpublic int getEncoderMaxObjectSize()
IllegalArgumentException
. The default value
is Integer.MAX_VALUE
.
This method does the same job with ObjectSerializationEncoder.getMaxObjectSize()
.
public void setEncoderMaxObjectSize(int maxObjectSize)
IllegalArgumentException
. The default value
is Integer.MAX_VALUE
.
This method does the same job with ObjectSerializationEncoder.setMaxObjectSize(int)
.
maxObjectSize
- The maximum size of the encoded objectpublic int getDecoderMaxObjectSize()
BufferDataException
. The default
value is 1048576
(1MB).
This method does the same job with ObjectSerializationDecoder.getMaxObjectSize()
.
public void setDecoderMaxObjectSize(int maxObjectSize)
BufferDataException
. The default
value is 1048576
(1MB).
This method does the same job with ObjectSerializationDecoder.setMaxObjectSize(int)
.
maxObjectSize
- The maximum size of the decoded objectpublic void accept(ClassNameMatcher classNameMatcher)
classNameMatcher
- the matcher to usepublic void accept(Pattern pattern)
pattern
- standard Java regexppublic void accept(String... patterns)
patterns
- Wildcard file name patterns as defined by
org.apache.commons.io.FilenameUtils#wildcardMatch(String, String)Copyright © 2004–2025 Apache MINA Project. All rights reserved.