RFR: 8067661 transferTo() for Appendable

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

RFR: 8067661 transferTo() for Appendable

Patrick Reinhart
After discussing [0] for about the API for the new transferTo() method on Appendable, I have created an initial
Version of the actual implementation for review:

http://cr.openjdk.java.net/~reinhapa/reviews/8067661/webrev.00/index.html

Any comments/suggestions are welcome, also I will need a sponsor for it at the end…

-Patrick

[0|] http://mail.openjdk.java.net/pipermail/core-libs-dev/2017-November/049797.html

Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8067661 transferTo() for Appendable

Alan Bateman
On 05/11/2017 08:34, Patrick Reinhart wrote:
> After discussing [0] for about the API for the new transferTo() method on Appendable, I have created an initial
> Version of the actual implementation for review:
>
> http://cr.openjdk.java.net/~reinhapa/reviews/8067661/webrev.00/index.html
>
> Any comments/suggestions are welcome, also I will need a sponsor for it at the end…
>
CharBuffer may need special attention. It implements both Readable and
Appendable and additional creates the potential for
BufferOverflowException or ReadOnlyBufferException when the target is a
CharBuffer. This is only so much that the javadoc in Readable can
specify of course.

One possibly is to override the method in CharBuffer so that you can
clarify some of this behavior. This would allow you to specify that it
works like target.put(src) when both are char buffers for example - that
probably is a nice property to specify anyway.

Are you planning to add an @implSpec to specify the default implementation?

-Alan.
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8067661 transferTo() for Appendable

Patrick Reinhart

> Am 05.11.2017 um 11:02 schrieb Alan Bateman <[hidden email]>:
>
> On 05/11/2017 08:34, Patrick Reinhart wrote:
>> After discussing [0] for about the API for the new transferTo() method on Appendable, I have created an initial
>> Version of the actual implementation for review:
>>
>> http://cr.openjdk.java.net/~reinhapa/reviews/8067661/webrev.00/index.html
>>
>> Any comments/suggestions are welcome, also I will need a sponsor for it at the end…
>>
> CharBuffer may need special attention. It implements both Readable and Appendable and additional creates the potential for BufferOverflowException or ReadOnlyBufferException when the target is a CharBuffer. This is only so much that the javadoc in Readable can specify of course.
>
> One possibly is to override the method in CharBuffer so that you can clarify some of this behavior. This would allow you to specify that it works like target.put(src) when both are char buffers for example - that probably is a nice property to specify anyway.
>

This sounds reasonable and worth while doing. I will take a deeper look into that one, as soon I have finished the default implementation.


> Are you planning to add an @implSpec to specify the default implementation?

I can do that, but I may need some assistance for the language specific parts of it. Would you add the CharBuffer potential exceptions there or more or less describe the default implementation?

>
> -Alan.

-Patrick