public final class CompositeTextBasedResponseDetector extends java.lang.Object implements ITextBasedResponseDetector
This class is thread-safe.
Constructor and Description |
---|
CompositeTextBasedResponseDetector(ITextBasedResponseDetector... detectors)
Creates a new composite detector given the list of detectors to wrap.
|
Modifier and Type | Method and Description |
---|---|
static void |
appendDetector(IHttpConversation conversation,
ITextBasedResponseDetector detector)
Convenience method to append a detector to a conversation.
|
java.nio.charset.Charset |
performDetection(IReceiveEvent event)
Performs the detection of the charset of the response described by the event.
|
public CompositeTextBasedResponseDetector(ITextBasedResponseDetector... detectors)
CompositeTextBasedResponseDetector
instance is found, the detectors inside of it get unwrapped and placed
into this one.detectors
- the array of detectors to wrap, can be nullpublic static void appendDetector(IHttpConversation conversation, ITextBasedResponseDetector detector)
CompositeTextBasedResponseDetector
is created with that one and the one
in the argument and then it gets set for the conversation. Otherwise the detector in the argument gets simply set.conversation
- the conversation to which the specified detector is to be added, must be non-nulldetector
- the detector to append, must be non-nullpublic java.nio.charset.Charset performDetection(IReceiveEvent event) throws java.io.IOException
ITextBasedResponseDetector
IReceiveEvent.getReader()
method is guaranteed to return null.
Just like for response filters, the conversation flow allows this method to sniff into the input stream which will be rewound after the invocation of this method.
performDetection
in interface ITextBasedResponseDetector
event
- the receive event (containing all information except for the reader), must be non-nulljava.io.IOException
- in case of any errors during detection (typically resulting from sniffing into the response stream)