public class ObjectSerializationDecoder extends CumulativeProtocolDecoder
ProtocolDecoder
which deserializes Serializable
Java
objects using IoBuffer.getObject(ClassLoader)
.Constructor and Description |
---|
ObjectSerializationDecoder()
Creates a new instance with the
ClassLoader of
the current thread. |
ObjectSerializationDecoder(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.
|
protected boolean |
doDecode(IoSession session,
IoBuffer in,
ProtocolDecoderOutput out)
Implement this method to consume the specified cumulative buffer and
decode its content into message(s).
|
int |
getMaxObjectSize() |
void |
setMaxObjectSize(int maxObjectSize)
Sets the allowed maximum size of the object to be decoded.
|
decode, dispose, setTransportMetadataFragmentation
finishDecode
public ObjectSerializationDecoder()
ClassLoader
of
the current thread.public ObjectSerializationDecoder(ClassLoader classLoader)
ClassLoader
.classLoader
- The class loader to usepublic int getMaxObjectSize()
BufferDataException
. The default
value is 1048576
(1MB).public void setMaxObjectSize(int maxObjectSize)
BufferDataException
. The default
value is 1048576
(1MB).maxObjectSize
- The maximum size for an object to be decodedprotected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception
doDecode
in class CumulativeProtocolDecoder
session
- The current Sessionin
- the cumulative bufferout
- The ProtocolDecoderOutput
that will receive the decoded messagetrue
if and only if there's more to decode in the buffer
and you want to have doDecode
method invoked again.
Return false
if remaining data is not enough to decode,
then this method will be invoked again when more data is
cumulated.Exception
- if cannot decode in
.public 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.