You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Stefan Bodewig <bo...@apache.org> on 2009/03/18 06:12:03 UTC

[compress] Protected API

Hi,

some of the classes inherited from Ant contain protected fields that
are only there for backwards compatibility reasons.

For example ZipOutputStream in Ant used to extend
java.util.zip.DeflaterOutputStream in Ant 1.4 which exposes the
Deflater as a non-final protected field - when we changes the the
class to inherit from OutputStream directly we decided to keep those
fields exposed.

commons-compress doesn't need to think about backwards compatibilty
right now, but every method or field we expose now will be there to
stay.

I'd like to remove some fields, make them private or final and maybe
move some methods around before our first release.  In particular:

ZipArchiveOutputStream
======================

* make def final

* make buf private final

* move toDosTime and adjustToLong to a helper class

ZipFile
=======

* move fromDosTime to a helper class

TarArchiveInputStream (see also SANDBOX-294)
============================================

* make buffer final

* make debug, entrySize, entryOffset, readBuf private

* make hasHitEOF, currEntry private and provide protected accessors

* make oneBuf private final

* remove the in field completely

TarArchiveOutputStream
======================

* make buffer final

* make debug, currSize, currName, currBytes, recordBuf, assemLen
  and longfileMode private

* make oneBuf and assemBuf private final

* remove getHeader method

Any objections?

    Stefan

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


Re: [compress] Protected API

Posted by Christian Grobmeier <gr...@gmail.com>.
I added a patch for CPIO to SANDBOX-294
Cheers

On Wed, Mar 18, 2009 at 11:22 AM, sebb <se...@gmail.com> wrote:
> On 18/03/2009, Stefan Bodewig <bo...@apache.org> wrote:
>> On 2009-03-18, Stefan Bodewig <bo...@apache.org> wrote:
>>
>>  > I'd like to remove some fields, make them private or final and maybe
>>  > move some methods around before our first release.  In particular:
>>
>>
>> I just saw sebb's patch attached to SANDBOX-294 and he seems to agree
>>  with most of my points.
>
> Yes - start with no non-private mutable variables (hopefully keep it
> that way), and only make methods non-private if they are needed for
> the API or the class hierarchy.
>
>>  In addition the patch makes some package
>>  private fields bzip2 private - which I think is a a good idea as well.
>>
>>
>>  Stefan
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

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


Re: [compress] Protected API

Posted by sebb <se...@gmail.com>.
On 18/03/2009, Stefan Bodewig <bo...@apache.org> wrote:
> On 2009-03-18, Stefan Bodewig <bo...@apache.org> wrote:
>
>  > I'd like to remove some fields, make them private or final and maybe
>  > move some methods around before our first release.  In particular:
>
>
> I just saw sebb's patch attached to SANDBOX-294 and he seems to agree
>  with most of my points.

Yes - start with no non-private mutable variables (hopefully keep it
that way), and only make methods non-private if they are needed for
the API or the class hierarchy.

>  In addition the patch makes some package
>  private fields bzip2 private - which I think is a a good idea as well.
>
>
>  Stefan
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

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


Re: [compress] Protected API

Posted by Christian Grobmeier <gr...@gmail.com>.
Hi,

I think restrict visibility whereever possible would be a good idea
too. You can loosen later if one wants to.

I just checked out CPIO, AR and JAR. The latter two contain so less
code, everything looks good. But CPIO needs some work...

However, I guess you want to:

CpioArchiveInputStream
- make singleByteBuf and tmpbuf  final
- make byteArray2long static and move to helper

CpioArchiveOutputStream
- make "names"  final (this map is beeing used to detect duplicate entries)
- make setFormat to private. The class lets you set the format in the
constructor of the class OR sets the format for the first entry you
put, if you don't have a format specified. setFormat would make it
possible to change the Fomat while putting.
- Several methods are synchronized. I don't think that makes very much
sense. I'm speaking of putNextEntry, closeEntry, write and finish.
- move long2byteArray to helper

Question: its possible to add ArchiveEntrys with different format. I
think this is illegal and should be checked in putArchiveEntry - if
so, we need a FIXME here :-)

CpioArchiveEntry:
- Default Constructor should set a format
- setFormat should be private (and final? This is checked in the
stream classes, noone can easily override this - or should do that)

If you agree with the CPIO changes, I can do the patch.
Cheers
Christian


On Wed, Mar 18, 2009 at 6:23 AM, Stefan Bodewig <bo...@apache.org> wrote:
> On 2009-03-18, Stefan Bodewig <bo...@apache.org> wrote:
>
>> I'd like to remove some fields, make them private or final and maybe
>> move some methods around before our first release.  In particular:
>
> I just saw sebb's patch attached to SANDBOX-294 and he seems to agree
> with most of my points.  In addition the patch makes some package
> private fields bzip2 private - which I think is a a good idea as well.
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

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


Re: [compress] Protected API

Posted by Stefan Bodewig <bo...@apache.org>.
On 2009-03-18, Stefan Bodewig <bo...@apache.org> wrote:

> I'd like to remove some fields, make them private or final and maybe
> move some methods around before our first release.  In particular:

I just saw sebb's patch attached to SANDBOX-294 and he seems to agree
with most of my points.  In addition the patch makes some package
private fields bzip2 private - which I think is a a good idea as well.

Stefan

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