Le 07/08/15 11:18, [email protected] a écrit :
> I am new to Apache Mina so this may be a basic question.
>
> If I use a CompressionFilter (created with default constructor), then is it
> able to get to know whether the received data is compressed or not?

Short answer : no. The only way for you to tell the filter that the data
is compressed is when you add the filter in the chain. You have to tell
it if it will receive or send compressed data :

    /**
     * Creates a new instance.
     *
     * @param compressInbound <tt>true</tt> if data read is to be
decompressed
     * @param compressOutbound <tt>true</tt> if data written is to be
compressed
     * @param compressionLevel the level of compression to be used. Must
     *                         be one of {@link #COMPRESSION_DEFAULT},
     *                         {@link #COMPRESSION_MAX},
     *                         {@link #COMPRESSION_MIN}, and
     *                         {@link #COMPRESSION_NONE}.
     */
    public CompressionFilter(final boolean compressInbound, final
boolean compressOutbound, final int compressionLevel) {
        this.compressionLevel = compressionLevel;
        this.compressInbound = compressInbound;
        this.compressOutbound = compressOutbound;
    }

So you *have* to know that the data is compressed.

The good thing is that you can add the filter in the chain whenever you
want (typically after having received an info that the following
messages are going to be compressed).


Reply via email to