[ https://issues.apache.org/jira/browse/HBASE-16880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15589032#comment-15589032 ]
Anoop Sam John commented on HBASE-16880: ---------------------------------------- Am +1 to change the code so as to make it behave like ByteBuffer put API. ie advance pos in the 'in' buf also and correct the javadoc. > Correct the javadoc/behaviour of the APIs in ByteBufferUtils > ------------------------------------------------------------ > > Key: HBASE-16880 > URL: https://issues.apache.org/jira/browse/HBASE-16880 > Project: HBase > Issue Type: Bug > Reporter: ramkrishna.s.vasudevan > Assignee: ramkrishna.s.vasudevan > > There are some issues either with the javadoc or the actual behaviour of some > APIs in BBUtils. > For eg, > BBUtil#copyFromBufferToBuffer() says > {code} > /** > * Copy one buffer's whole data to another. Write starts at the current > position of 'out' buffer. > * Note : This will advance the position marker of {@code out} but not > change the position maker > * for {@code in}. The position and limit of the {@code in} buffer to be > set properly by caller. > * @param in source buffer > * @param out destination buffer > {code} > But this is true in case of UNSAFE. > {code} > if (UNSAFE_AVAIL) { > int length = in.remaining(); > UnsafeAccess.copy(in, in.position(), out, out.position(), length); > out.position(out.position() + length); > } else { > out.put(in); > } > {code} > But in other case where we move the else - the 'in' is also advanced. So we > need to either correct the behaviour or change the doc and see all the used > places. This JIRA can be used to correct all the APIs in this util class. -- This message was sent by Atlassian JIRA (v6.3.4#6332)