You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "David M. Lloyd (JIRA)" <ji...@apache.org> on 2007/12/07 04:31:43 UTC

[jira] Created: (DIRMINA-490) Add a getSlice(int) method to IoBuffer

Add a getSlice(int) method to IoBuffer
--------------------------------------

                 Key: DIRMINA-490
                 URL: https://issues.apache.org/jira/browse/DIRMINA-490
             Project: MINA
          Issue Type: New Feature
          Components: Core
            Reporter: David M. Lloyd
            Priority: Minor
             Fix For: 2.0.0-M1


Add a method to IoBuffer that lets you read a given number of bytes, returning those bytes as a slice IoBuffer.

Enclosed is a simple patch to do this.  This method can be implemented completely in terms of other IoBuffer methods; therefore it can go on the IoBuffer base class without affecting other subclasses.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-490) Add a getSlice(int) method to IoBuffer

Posted by "David M. Lloyd (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549452 ] 

David M. Lloyd commented on DIRMINA-490:
----------------------------------------

Ah, that makes sense.

> Add a getSlice(int) method to IoBuffer
> --------------------------------------
>
>                 Key: DIRMINA-490
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-490
>             Project: MINA
>          Issue Type: New Feature
>          Components: Core
>            Reporter: David M. Lloyd
>            Assignee: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>         Attachments: getSlice.patch
>
>
> Add a method to IoBuffer that lets you read a given number of bytes, returning those bytes as a slice IoBuffer.
> Enclosed is a simple patch to do this.  This method can be implemented completely in terms of other IoBuffer methods; therefore it can go on the IoBuffer base class without affecting other subclasses.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-490) Add a getSlice(int) method to IoBuffer

Posted by "David M. Lloyd (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549444 ] 

David M. Lloyd commented on DIRMINA-490:
----------------------------------------

Just out of curiosity, why jump through all the hoops just to use the .slice() method?  Using the .duplicate() method makes the implementation simpler.

> Add a getSlice(int) method to IoBuffer
> --------------------------------------
>
>                 Key: DIRMINA-490
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-490
>             Project: MINA
>          Issue Type: New Feature
>          Components: Core
>            Reporter: David M. Lloyd
>            Assignee: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>         Attachments: getSlice.patch
>
>
> Add a method to IoBuffer that lets you read a given number of bytes, returning those bytes as a slice IoBuffer.
> Enclosed is a simple patch to do this.  This method can be implemented completely in terms of other IoBuffer methods; therefore it can go on the IoBuffer base class without affecting other subclasses.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-490) Add a getSlice(int) method to IoBuffer

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549445 ] 

Trustin Lee commented on DIRMINA-490:
-------------------------------------

It was to make the sliced buffer less error-prone.  Calling duplicate allows a user to move the position of the duplicated buffer before where it was originally sliced, which is error-prone in some cases because a user can easily assume that the offset of the first byte is 0.  Using slice(), you can ensure the offset of the first byte is always 0, which makes the sliced buffer look more like a separate buffer so a user don't make a mistake.

> Add a getSlice(int) method to IoBuffer
> --------------------------------------
>
>                 Key: DIRMINA-490
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-490
>             Project: MINA
>          Issue Type: New Feature
>          Components: Core
>            Reporter: David M. Lloyd
>            Assignee: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>         Attachments: getSlice.patch
>
>
> Add a method to IoBuffer that lets you read a given number of bytes, returning those bytes as a slice IoBuffer.
> Enclosed is a simple patch to do this.  This method can be implemented completely in terms of other IoBuffer methods; therefore it can go on the IoBuffer base class without affecting other subclasses.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRMINA-490) Add a getSlice(int) method to IoBuffer

Posted by "David M. Lloyd (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549430 ] 

David M. Lloyd commented on DIRMINA-490:
----------------------------------------

Cool, thanks.

> Add a getSlice(int) method to IoBuffer
> --------------------------------------
>
>                 Key: DIRMINA-490
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-490
>             Project: MINA
>          Issue Type: New Feature
>          Components: Core
>            Reporter: David M. Lloyd
>            Assignee: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>         Attachments: getSlice.patch
>
>
> Add a method to IoBuffer that lets you read a given number of bytes, returning those bytes as a slice IoBuffer.
> Enclosed is a simple patch to do this.  This method can be implemented completely in terms of other IoBuffer methods; therefore it can go on the IoBuffer base class without affecting other subclasses.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DIRMINA-490) Add a getSlice(int) method to IoBuffer

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-490?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny closed DIRMINA-490.
-------------------------------------


> Add a getSlice(int) method to IoBuffer
> --------------------------------------
>
>                 Key: DIRMINA-490
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-490
>             Project: MINA
>          Issue Type: New Feature
>          Components: Core
>            Reporter: David M. Lloyd
>            Assignee: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>         Attachments: getSlice.patch
>
>
> Add a method to IoBuffer that lets you read a given number of bytes, returning those bytes as a slice IoBuffer.
> Enclosed is a simple patch to do this.  This method can be implemented completely in terms of other IoBuffer methods; therefore it can go on the IoBuffer base class without affecting other subclasses.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRMINA-490) Add a getSlice(int) method to IoBuffer

Posted by "David M. Lloyd (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-490?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David M. Lloyd updated DIRMINA-490:
-----------------------------------

    Attachment: getSlice.patch

The patch to implement the getSlice() method

> Add a getSlice(int) method to IoBuffer
> --------------------------------------
>
>                 Key: DIRMINA-490
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-490
>             Project: MINA
>          Issue Type: New Feature
>          Components: Core
>            Reporter: David M. Lloyd
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>         Attachments: getSlice.patch
>
>
> Add a method to IoBuffer that lets you read a given number of bytes, returning those bytes as a slice IoBuffer.
> Enclosed is a simple patch to do this.  This method can be implemented completely in terms of other IoBuffer methods; therefore it can go on the IoBuffer base class without affecting other subclasses.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DIRMINA-490) Add a getSlice(int) method to IoBuffer

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRMINA-490?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Trustin Lee resolved DIRMINA-490.
---------------------------------

    Resolution: Fixed
      Assignee: Trustin Lee

I've just added IoBuffer.getSlice(int length) and IoBuffer.getSlice(int index, int length).  The former uses the current position of the buffer and throws IndexOutOfBoundsException if position + length exceeds the current limit.  The latter is similar to other getter methods with index; it doesn't bother with the current position and limit of the buffer.  Please try these methods and close this issue if you are satisfied with the implementation.  :)

> Add a getSlice(int) method to IoBuffer
> --------------------------------------
>
>                 Key: DIRMINA-490
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-490
>             Project: MINA
>          Issue Type: New Feature
>          Components: Core
>            Reporter: David M. Lloyd
>            Assignee: Trustin Lee
>            Priority: Minor
>             Fix For: 2.0.0-M1
>
>         Attachments: getSlice.patch
>
>
> Add a method to IoBuffer that lets you read a given number of bytes, returning those bytes as a slice IoBuffer.
> Enclosed is a simple patch to do this.  This method can be implemented completely in terms of other IoBuffer methods; therefore it can go on the IoBuffer base class without affecting other subclasses.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.