[protobuf] Private constructor in ByteString

2012-06-22 Thread Anatoly Deyneka
Why 
ByteStringhttp://code.google.com/p/protobuf/source/browse/trunk/java/src/main/java/com/google/protobuf/ByteString.java
 has 
only private constructor?
Copying arrays is overhead in my case.

What's about adding valueOf or making constructor public?

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/protobuf/-/NhZsLmMxErEJ.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Private constructor in ByteString

2012-06-22 Thread Oliver Jowett
On Thu, Jun 21, 2012 at 7:08 AM, Anatoly Deyneka adeyn...@gmail.com wrote:
 Why ByteString has only private constructor?
 Copying arrays is overhead in my case.

I believe it's that way to guarantee the immutability of a ByteString.

Oliver

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.