It is my first project using mina and I have to admit that I may not really
understand the idea of Filter or ProtocolCodecFilter chaining. 
I am implementing a client for a custom binary tcp protocol, extending from
DemuxingProtocolCodecFactory. Everything working so far, encoding and
sending RequestMessages and also receiving and decoding ResponseMessages.
Now one of my MessageEncoders needs to encode a file in blocks of 512byte
add some additional bytes like magic and crc (don't ask!) to it and sends
it. I am trying to use the FileRegionWriteFilter for it but can not figure
it out how I can set up the filter chain.

Like for all the other RequestMessages I have an pojo with a file handle and
an Encoder class which implements MessageEncoder<T> and should only encode a
chunk of 512bytes. 
Like the other MessageEncoders these are set up like this:
super.addMessageEncoder(WriteFile.class, WriteFileEncoder.class);
But in contrast to the other MessageEncoders which are set-up in a factory
like this:
"super.addMessageEncoder(Data.class, DataEncoder.class)" and where each
data-class relates exactly to one encoder-class, for the "FileEncoder" I
need to call "encode()" many times.

Now how can I add a FileRegionWriteFilter and use FileRegions for the
data-chunks?





--
View this message in context: 
http://apache-mina.10907.n7.nabble.com/help-with-FileRegionWriteFilter-tp39754.html
Sent from the Apache MINA User Forum mailing list archive at Nabble.com.

Reply via email to