You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Emmanuel Lecharny (JIRA)" <ji...@apache.org> on 2014/09/07 09:19:28 UTC

[jira] [Resolved] (DIRMINA-507) IoBuffer: Support prepending data

     [ https://issues.apache.org/jira/browse/DIRMINA-507?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny resolved DIRMINA-507.
---------------------------------------
    Resolution: Won't Fix

Utterly complicated proposal. At some point, one should rely on the GC to handle the fast allocation of buffer, instead of manipulating existing buffers, that will need to be somehow cached, leading to management costs and synchronization issue. "Better" is the enemy of "good enough".

Unless someone comes with a proven faster and more efficient solution...

> IoBuffer: Support prepending data
> ---------------------------------
>
>                 Key: DIRMINA-507
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-507
>             Project: MINA
>          Issue Type: New Feature
>          Components: Core
>            Reporter: David M. Lloyd
>            Priority: Minor
>             Fix For: 2.0.8
>
>
> I'd like to see IoBuffer enhanced to support prepending data.  It could work as follows:
> * A means to specificy or reserve space should be provided.  An IoBuffer.reserve() method could do the trick, and maybe a 3-parameter version of IoBuffer.  IoBuffer.reserve() would keep the position at zero, but decrease the capacity and limit by the given number of bytes, and move the buffer start up by the given number of bytes.
> * A means to reclaim the space must be provided.  An IoBuffer.reclaim() would work by moving the buffer start back down by the given amount, maybe returning a slice to the recovered area.  Or another alternative would be to have a series of prepend* methods which would prepend bytes/ints/etc. similar to put*(), but rather than adding to the end of the buffer, they would add to the beginning, moving the buffer start back down to the start of the just-written data.  Though I'm not sure how helpful it would be to add another dozen methods to a class that already has probably over a hundred methods.
> * Care should be taken that the mechanism to prepend data does not allow a user to "escape" a buffer slice.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)