Bugs/2674/utf8

It's fixing #2674. It also significantly increases performance of UTF encoding.
No, we don't:-) That's something I want to discuss, that's why I kept it
there. It's basically a trade off between speed and safety. It's an
internal API, this method is called for each String to be deserialized. My
optimization requires buffer size to be always a power of 2. Now every well
designed API should enforce this constraint, but given this is *very*
performance critical code it might make sense to omit the check. WDYT?
On 12 Jun 2014 21:06, "Ahmet Mircik" <notifications@github.com> wrote:

> In hazelcast/src/main/java/com/hazelcast/nio/UTFEncoderDecoder.java:
>
> > @@ -130,6 +130,9 @@ private void writeShortUTF(final DataOutput out,
> >      }
> >
> >      public String readUTF0(final DataInput in, byte[] buffer) throws IOException {
> > +//        if (!isPowerOfTwo(buffer.length)) {
> > +//            throw new IllegalArgumentException("Size of the buffer has to be power of two");
> > +//        } //TODO: Do we want to be fast or defensive?
>
> Do we need these commented parts?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/hazelcast/hazelcast/pull/2711/files#r13723240>.
>