[ 
http://issues.apache.org/jira/browse/HADOOP-310?page=comments#action_12417172 ] 

Andrzej Bialecki  commented on HADOOP-310:
------------------------------------------

Perhaps a more general constructor, similar to the ones used in many other 
places, would be better:

/**
   * Create a BytesWritable using a part of the byte array as the initial value.
   */
  public BytesWritable(byte[] bytes, int offset, int length) {
    ....
  }

This way it would satisfy your requirement, and perhaps help to avoid many 
other cases of copying ...


> Additional constructor requested in BytesWritable
> -------------------------------------------------
>
>          Key: HADOOP-310
>          URL: http://issues.apache.org/jira/browse/HADOOP-310
>      Project: Hadoop
>         Type: Improvement

>   Components: io
>     Reporter: paul sutter
>     Priority: Minor

>
> It would be grand if BytesWritable.java had an additional constructor as 
> below. This allows me to use the BytesWritable class without doing a buffer 
> copy, since we have a less-than-fully-utilized byte array holding our key.
> Thanks!
>  
>  /**
>    * Create a BytesWritable using the byte array as the initial value.
>    * @param bytes This array becomes the backing storage for the object.
>    */
>   public BytesWritable(byte[] bytes, int size) {
>     this.bytes = bytes;
>     this.size = size;
>   }
>   

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to