Unicode script support in Regex and Character class

Xueming Shen xueming.shen at oracle.com
Mon May 10 18:10:27 UTC 2010


Ulf,

Stuff under http://cr.openjdk.java.net/~sherman/script/webrev.00 just an 
idea about a
smaller-size alternative It is not a intended to replace the final bits 
for review at
http://cr.openjdk.java.net/~sherman/6945564_6948903/webrev
My bad, probably I should not mixed 2 things in one email.

Regarding "while" instead of "for" loop", it's because...I don't know:-) 
Maybe squeezing
multiple variables into a "for" statement makes it more "encapsulated"? 
but I doubt it
really matters.

-Sherman

Ulf Zibis wrote:
> Am 10.05.2010 03:05, schrieb Xueming Shen:
>>
>> Ulf,
>>
>> Can you be more specific? I'm not sure I understand your question. 
>> What "buffering"
>> are we talking here?
>
> In http://cr.openjdk.java.net/~sherman/6945564_6948903/webrev ,
> I think byte[] ba could be saved in initNamePool(), as you could 
> directly read from dis.
>
> In http://cr.openjdk.java.net/~sherman/script/webrev.00/:
>         dis.readFully(pool);
>         wordPool = new String(pool, "iso-8859-1").toCharArray();
> 1st copies to pool[] 2nd copies to internal String.value[] and then 
> 3rd again to wordPool.
> You could:
> do {
>     wordPool[i++] = (char)dis.read();
> }
>
>         dis.readFully(head);
>         dis.readFully(index);
>             startCP = dHead.readInt();
>             numCP = dHead.readShort() & 0xffff;
>                 prefixOff = dIndex.readShort() & 0xffff;
>                 int len = dIndex.read() & 0xff;
>                     wordOff[off++] = (char)dIndex.readShort();
> If you would fold index[] into head[], here you could also directly 
> read the values from dis.
>
>             wordOff = new char[index.length];
> If you would init wordOff to it's true final size, you could save:
>             wordOff = Arrays.copyOf(wordOff, off);
>
> Additionally I'm wondering about your love on while loops.
> In most cases I would prefer for loops with the concerning params 
> defined in the for statement.
>
> -Ulf
>
>> Ulf Zibis wrote:
>>> Sherman, I don't understand, why you use so much buffering.
>>> InputStream from getResourceAsStream, and I believe 
>>> InflaterInputStream too, is yet buffered.
>>>
>>> My understanding until now was, that access to buffered byte streams 
>>> is as fast as to naked byte arrays.
>>> Am I wrong?
>>>
>>> -Ulf
>>>
>




More information about the core-libs-dev mailing list