james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Bagnara <apa...@bago.org>
Subject Re: [mime4j] BufferingInputStreamAdaptor => BufferedInputStreamFilter
Date Mon, 14 Jul 2008 08:02:00 GMT
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

'- 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:

'- 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.



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

View raw message