commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Curdt <tcu...@vafer.org>
Subject Re: [COMPRESS] Add getArchiveType() method to [Archive|Compressor]InputStream classes?
Date Tue, 11 May 2010 20:50:04 GMT
>>  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.

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

See what I mean?

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

cheers
--
Torsten

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


Mime
View raw message