Thank you a lot.<div><br></div><div>- Bertrand<br><br><div class="gmail_quote">2009/9/21 Trustin Lee <span dir="ltr">&lt;<a href="mailto:trustin@gmail.com">trustin@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Hi Bertrand,<br>
<br>
Sorry for a late response.  It slipped out of my mailbox during my recent<br>
account migration.  I hope I&#39;m not too late.<br>
<br>
My suggestion for writing the buffer content to a file is:<br>
<br>
    RandomAccessFile raf = ...;<br>
<div class="im">    ChannelBuffer buf = (ChannelBuffer) e.getMessage();<br>
<br>
</div>    buf.readBytes(raf.getChannel(), buf.readableBytes());<br>
<br>
HTH,<br>
Trustin<br>
<div class="im"><br>
<br>
bgoetzmann wrote:<br>
&gt;<br>
&gt; Hello,<br>
&gt;<br>
&gt; In my custom handler&#39;s messageReceived, I would like write bytes contained<br>
&gt; in the ChannelBuffer instance into a file using a RandomAccessFile<br>
&gt; instance; so, a simple approach could be (where raf is the<br>
&gt; RandomAccessFile reference):<br>
&gt;<br>
&gt; ChannelBuffer buf = (ChannelBuffer) e.getMessage();<br>
&gt; while(buf.readable()) {<br>
&gt;     raf.writeByte(buf.readByte());<br>
&gt; }<br>
&gt;<br>
&gt; It works, but I think there is a more quick approach! Any idea?<br>
&gt;<br>
&gt; Thank you.<br>
&gt;<br>
&gt; Bertrand.<br>
&gt;<br>
<br>
<br>
</div>-----<br>
— Trustin Lee, <a href="http://gleamynode.net/" target="_blank">http://gleamynode.net/</a><br>
<font color="#888888">--<br>
View this message in context: <a href="http://n2.nabble.com/Reading-bytes-from-ChannelBuffer-writing-with-RandomAccessFile-tp3626803p3682670.html" target="_blank">http://n2.nabble.com/Reading-bytes-from-ChannelBuffer-writing-with-RandomAccessFile-tp3626803p3682670.html</a><br>

</font><div><div></div><div class="h5">Sent from the Netty User Group mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
netty-users mailing list<br>
<a href="mailto:netty-users@lists.jboss.org">netty-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/netty-users" target="_blank">https://lists.jboss.org/mailman/listinfo/netty-users</a><br>
</div></div></blockquote></div><br></div>