You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Stefano Bagnara <ap...@bago.org> on 2008/07/13 21:05:23 UTC

[mime4j] BufferingInputStreamAdaptor => BufferedInputStreamFilter

In java core classes a stream wrapping another stream extends 
FilterInputStream. BufferingInputStreamAdaptor cannot extends 
BufferingInputStream and FilterInputStream because we don't have 
polymorphism, but I think we should better name the class 
BufferingInputStreamFilter because Adaptor let me think of something 
converting an object in another type of objects, instead this simply 
wrap a stream adding buffering.

Another concern is that maybe "Buffered" is more used than "Buffering" 
so maybe we should also rename %BufferingInputStream% stuff to 
%BufferedInputStream%.

Opinions?

Stefano

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: [mime4j] BufferingInputStreamAdaptor => BufferedInputStreamFilter

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2008-07-14 at 17:54 +0200, Stefano Bagnara wrote:

...

> > Oleg
> 
> If I follow you then this could work for you:
> 
> FilterInputStream
> '- LineReaderInputStream (again abstract)
>     |- LineReaderInputStreamAdaptor (the current Adaptor)
>     |- BufferedLineReaderInputStream (the refactored InputBuffer)
>     '- MimeBoundaryInputStream
> 
> You can see I changed my mind about "BufferedInputStream" and named it 
> "BufferedLineReaderInputStream" because the former is already a java.io 
> class and reusing this name may be confusing.
> 

That would be perfectly fine with me. 

Oleg 


> Is anyone against a similar change (including MIME4J-50)?
> 
> Stefano
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: [mime4j] BufferingInputStreamAdaptor => BufferedInputStreamFilter

Posted by Stefano Bagnara <ap...@bago.org>.
Oleg Kalnichevski ha scritto:
> On Mon, Jul 14, 2008 at 10:02:00AM +0200, Stefano Bagnara wrote:
>> Oleg Kalnichevski ha scritto:
>>> Stefano Bagnara wrote:
>>>> In java core classes a stream wrapping another stream extends 
>>>> FilterInputStream. BufferingInputStreamAdaptor cannot extends 
>>>> BufferingInputStream and FilterInputStream because we don't have 
>>>> polymorphism, but I think we should better name the class 
>>>> BufferingInputStreamFilter because Adaptor let me think of something 
>>>> converting an object in another type of objects, instead this simply 
>>>> wrap a stream adding buffering.
>>>>
>>> Stefano,
>>>
>>> BufferingInputStreamAdaptor does not really add buffering to a stream. 
>>> It rather adds ability to read lines to input steams that do not support 
>>> BufferingInputStream interface natively. Thus, I felt adapter was a 
>>> better name for this class. I personally find filter misleading as there 
>>> is no filtering going on in this class.
>> Make sense! Thank you for the explanation.
>>
>> Filter would not be bad anyway because of this javadoc from 
>> FilterInputStream: "A FilterInputStream contains some other input 
>> stream, which it uses as its basic source of data, *possibly* 
>> transforming the data along the way *or* providing *additional* 
>> functionality", but I now agree that BufferedInputStreamFilter would be 
>> much more misleading than the current name.
>>
>>> Anyways I will not stand in your way if you think differently
>>>
>>> Oleg
>> If we apply MIME4J-50 we have
>>
>> FilterInputStream
>> '- BufferingInputStream
>>    |- BufferingInputStreamAdaptor
>>    |- InputBuffer
>>    '- MimeBoundaryInputStream
>>
>> In fact only InputBuffer and MimeBoundartInputStream provide buffering 
>> while "BufferingInputStream" is an abstract for "line reading to buffers".
>>
>> Maybe we should rename the tree somehow similar to this:
>>
>> FilterInputStream
>> '- LineReaderInputStream
>>    |- BufferedInputStream
>>    '- MimeBoundaryInputStream
>>
>> And have LineReaderInputStream already including the current 
>> BufferingInputStreamAdaptor code. We just don't need the abstract if we 
>> have a simple class for the most basic implementation.
>>
>> WDYT?
>>
>> Stefano
>>
> 
> Hi Stefano
> 
> I am fine with renaming the classes but I would like to keep the
> adapter class separate. It basically contains some ugly plumbing code
> which I would not like to pollute the LineReaderInputStream code with.
> I really would like to keep that inefficient, one byte at a time line
> reading code hidden away as much as possible.
> 
> Oleg

If I follow you then this could work for you:

FilterInputStream
'- LineReaderInputStream (again abstract)
    |- LineReaderInputStreamAdaptor (the current Adaptor)
    |- BufferedLineReaderInputStream (the refactored InputBuffer)
    '- MimeBoundaryInputStream

You can see I changed my mind about "BufferedInputStream" and named it 
"BufferedLineReaderInputStream" because the former is already a java.io 
class and reusing this name may be confusing.

Is anyone against a similar change (including MIME4J-50)?

Stefano

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: [mime4j] BufferingInputStreamAdaptor => BufferedInputStreamFilter

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, Jul 14, 2008 at 10:02:00AM +0200, Stefano Bagnara wrote:
> Oleg Kalnichevski ha scritto:
> >Stefano Bagnara wrote:
> >>In java core classes a stream wrapping another stream extends 
> >>FilterInputStream. BufferingInputStreamAdaptor cannot extends 
> >>BufferingInputStream and FilterInputStream because we don't have 
> >>polymorphism, but I think we should better name the class 
> >>BufferingInputStreamFilter because Adaptor let me think of something 
> >>converting an object in another type of objects, instead this simply 
> >>wrap a stream adding buffering.
> >>
> >
> >Stefano,
> >
> >BufferingInputStreamAdaptor does not really add buffering to a stream. 
> >It rather adds ability to read lines to input steams that do not support 
> >BufferingInputStream interface natively. Thus, I felt adapter was a 
> >better name for this class. I personally find filter misleading as there 
> >is no filtering going on in this class.
> 
> Make sense! Thank you for the explanation.
> 
> Filter would not be bad anyway because of this javadoc from 
> FilterInputStream: "A FilterInputStream contains some other input 
> stream, which it uses as its basic source of data, *possibly* 
> transforming the data along the way *or* providing *additional* 
> functionality", but I now agree that BufferedInputStreamFilter would be 
> much more misleading than the current name.
> 
> >Anyways I will not stand in your way if you think differently
> >
> >Oleg
> 
> If we apply MIME4J-50 we have
> 
> FilterInputStream
> '- BufferingInputStream
>    |- BufferingInputStreamAdaptor
>    |- InputBuffer
>    '- MimeBoundaryInputStream
> 
> In fact only InputBuffer and MimeBoundartInputStream provide buffering 
> while "BufferingInputStream" is an abstract for "line reading to buffers".
> 
> Maybe we should rename the tree somehow similar to this:
> 
> FilterInputStream
> '- LineReaderInputStream
>    |- BufferedInputStream
>    '- MimeBoundaryInputStream
> 
> And have LineReaderInputStream already including the current 
> BufferingInputStreamAdaptor code. We just don't need the abstract if we 
> have a simple class for the most basic implementation.
> 
> WDYT?
> 
> Stefano
> 

Hi Stefano

I am fine with renaming the classes but I would like to keep the
adapter class separate. It basically contains some ugly plumbing code
which I would not like to pollute the LineReaderInputStream code with.
I really would like to keep that inefficient, one byte at a time line
reading code hidden away as much as possible.

Oleg



> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: [mime4j] BufferingInputStreamAdaptor => BufferedInputStreamFilter

Posted by Stefano Bagnara <ap...@bago.org>.
Oleg Kalnichevski ha scritto:
> Stefano Bagnara wrote:
>> In java core classes a stream wrapping another stream extends 
>> FilterInputStream. BufferingInputStreamAdaptor cannot extends 
>> BufferingInputStream and FilterInputStream because we don't have 
>> polymorphism, but I think we should better name the class 
>> BufferingInputStreamFilter because Adaptor let me think of something 
>> converting an object in another type of objects, instead this simply 
>> wrap a stream adding buffering.
>>
> 
> Stefano,
> 
> BufferingInputStreamAdaptor does not really add buffering to a stream. 
> It rather adds ability to read lines to input steams that do not support 
> BufferingInputStream interface natively. Thus, I felt adapter was a 
> better name for this class. I personally find filter misleading as there 
> is no filtering going on in this class.

Make sense! Thank you for the explanation.

Filter would not be bad anyway because of this javadoc from 
FilterInputStream: "A FilterInputStream contains some other input 
stream, which it uses as its basic source of data, *possibly* 
transforming the data along the way *or* providing *additional* 
functionality", but I now agree that BufferedInputStreamFilter would be 
much more misleading than the current name.

> Anyways I will not stand in your way if you think differently
> 
> Oleg

If we apply MIME4J-50 we have

FilterInputStream
'- BufferingInputStream
    |- BufferingInputStreamAdaptor
    |- InputBuffer
    '- MimeBoundaryInputStream

In fact only InputBuffer and MimeBoundartInputStream provide buffering 
while "BufferingInputStream" is an abstract for "line reading to buffers".

Maybe we should rename the tree somehow similar to this:

FilterInputStream
'- LineReaderInputStream
    |- BufferedInputStream
    '- MimeBoundaryInputStream

And have LineReaderInputStream already including the current 
BufferingInputStreamAdaptor code. We just don't need the abstract if we 
have a simple class for the most basic implementation.

WDYT?

Stefano

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: [mime4j] BufferingInputStreamAdaptor => BufferedInputStreamFilter

Posted by Oleg Kalnichevski <ol...@apache.org>.
Stefano Bagnara wrote:
> In java core classes a stream wrapping another stream extends 
> FilterInputStream. BufferingInputStreamAdaptor cannot extends 
> BufferingInputStream and FilterInputStream because we don't have 
> polymorphism, but I think we should better name the class 
> BufferingInputStreamFilter because Adaptor let me think of something 
> converting an object in another type of objects, instead this simply 
> wrap a stream adding buffering.
> 

Stefano,

BufferingInputStreamAdaptor does not really add buffering to a stream. 
It rather adds ability to read lines to input steams that do not support 
BufferingInputStream interface natively. Thus, I felt adapter was a 
better name for this class. I personally find filter misleading as there 
is no filtering going on in this class.

Anyways I will not stand in your way if you think differently

Oleg


> Another concern is that maybe "Buffered" is more used than "Buffering" 
> so maybe we should also rename %BufferingInputStream% stuff to 
> %BufferedInputStream%.
> 
> Opinions?
> 
> Stefano
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: [mime4j] BufferingInputStreamAdaptor => BufferedInputStreamFilter

Posted by Norman Maurer <no...@apache.org>.
Am Sonntag, den 13.07.2008, 20:21 +0100 schrieb Robert Burrell Donkin:
> On Sun, Jul 13, 2008 at 8:05 PM, Stefano Bagnara <ap...@bago.org> wrote:
> > In java core classes a stream wrapping another stream extends
> > FilterInputStream. BufferingInputStreamAdaptor cannot extends
> > BufferingInputStream and FilterInputStream because we don't have
> > polymorphism, but I think we should better name the class
> > BufferingInputStreamFilter because Adaptor let me think of something
> > converting an object in another type of objects, instead this simply wrap a
> > stream adding buffering.
> >
> > Another concern is that maybe "Buffered" is more used than "Buffering" so
> > maybe we should also rename %BufferingInputStream% stuff to
> > %BufferedInputStream%.
> >
> > Opinions?
> 
> +1
> 
> - robert

What about name it ...Wrapper ?

Bye
Norman


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Re: [mime4j] BufferingInputStreamAdaptor => BufferedInputStreamFilter

Posted by Robert Burrell Donkin <ro...@gmail.com>.
On Sun, Jul 13, 2008 at 8:05 PM, Stefano Bagnara <ap...@bago.org> wrote:
> In java core classes a stream wrapping another stream extends
> FilterInputStream. BufferingInputStreamAdaptor cannot extends
> BufferingInputStream and FilterInputStream because we don't have
> polymorphism, but I think we should better name the class
> BufferingInputStreamFilter because Adaptor let me think of something
> converting an object in another type of objects, instead this simply wrap a
> stream adding buffering.
>
> Another concern is that maybe "Buffered" is more used than "Buffering" so
> maybe we should also rename %BufferingInputStream% stuff to
> %BufferedInputStream%.
>
> Opinions?

+1

- robert

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org