On 29/03/2009, sebb <seb...@gmail.com> wrote: > On 29/03/2009, sebb <seb...@gmail.com> wrote: > > The current ChangeSet API allows for: > > + deletion of entries by name
The same method call is currently used for both deleting a single file, and for deleting a directory tree. If the string matches a file, it is deleted, but if it happens to match a directory name, then the directory and any contents are deleted. Both of these are useful functions, but I think they should have different method calls to avoid accidents. > > + addition of entries by ArchiveEntry and InputStream. > > > Forgot about "Move", which is not yet implemented. > > I think that should be called "Rename", unless it really means to move > the entry elsewhere in the file. > > > > > > This is fine as far as it goes, but I think it would be useful to add: > > + addition of entries by File > > + replacement of an existing named entry by File or Entry+InputStream > > > > It may also be useful to allow the location of new entries to be > > specified. For example, one might want to add META-INF data at the > > front of an archive. It would be useful to specify the locations as: > > + start > > + end > > > > [I'm not sure if there is a use-case for adding entries relative to an > > existing entry, and it would complicate the processing. None of the > > archivers I have used allow this.] > > > > I think it would be quite easy to implement: > > + open output file, add any starting entries > > + for each input entry, either copy, skip or replace with new entry > > > or rename, if that has been requested. > > > > + at end of input, add any final entries. > > + close archive files > > > > This could be achieved with: > > + HashSet containing names to be deleted > > + HashMap containing new entries for existing names > > > Or combine them into a single HashMap which has operations delete, > replace, rename. And now delete directory tree. > > > + 2 Lists for new entries. > > > Start and and. That should be Start and End. > > > > > > Using Hashes would avoid scanning the list. > > Also, I don't think any of the above would need to be updated during > > perform(), which would allow them to be re-used on another archive. > > > > However, the creation of the collections would be slightly more involved. > > > > It would probably be useful to have a "NewEntry" class which either > > has a File, or has an InputStream + ArchiveEntry to describe it. > > > > The "NewEntry" class might also be useful for ArchiveOutputStream. > > > > WDYT? > > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org