commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: [COMPRESS] Add getArchiveType() method to [Archive|Compressor]InputStream classes?
Date Tue, 11 May 2010 20:59:47 GMT
On 11/05/2010, Torsten Curdt <tcurdt@vafer.org> wrote:
> >>  That said: Is there a particular reason you need this? Or is this just
>  >>  because you think it might be useful?
>  >
>  > I was thinking it would be useful for the proposed command-line
>  > utility - you could pass it any archive file and find out what it is.
>
>
> Hm ...all you would get is the implementation identifier for the
>  factory, not the type of the archive.

Surely one would get the identifier for the Stream class?

>  IIUC you want the type of the archive, but we are dealing here with
>  Archiver implementations. In theory we could have 2 different
>  implementations for e.g. "zip".

But they would both return "zip", which is what is wanted.

>  See what I mean?

No, I don't.

>  I am not really against it but I am not a fan either.
>
>
>  > Also it would be useful for unit tests, to check that the correct type
>  > has been detected.
>
>
> Uhm ... Unit test are the perfect place to use instance or class comparisons :)
>
>  ...as we do currently
>
>         final ArchiveInputStream tar = getStreamFor("bla.tar");
>         assertNotNull(tar);
>         assertTrue(tar instanceof TarArchiveInputStream);
>
>  Since a simple HashMap could solve the task of reverse mapping for a
>  real type lookup just fine - I would not add it ...but this is not a
>  -1

Of course one can use a HashMap, but that would have to be updated for
every new implementation.

>  cheers
>  --
>
> Torsten
>
>
>  ---------------------------------------------------------------------
>  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


Mime
View raw message