On 11/05/2010, Torsten Curdt <[email protected]> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]