> Just tossing out ideas > > class OwnerInformation { > int getUserId(); > int getGroupId(); > String getUserName(); > String getGroupName(); > } > > class ArchiveEntry { > OwnerInformation getOwner(); > } > > ZIP would return null on getOwner, AR and CPIO return null in the *Name > methods.
That would make sense. >> Right. What we could think of is to delegate the metadata by type. > >> entry.getUnixMetadata() > > POSIX rather than Unix. True :-p > I had a look at > http://download.java.net/jdk7/docs/api/java/nio/file/attribute/PosixFileAttributes.html > and somewhat like the approach of having a Set of permissions rather > than a multitude of canOwnerRead() type of methods - even if we can't > use generics or enums. > > class PosixAttributes { > /* nine constants */ > static final int OWNER_CAN_READ = ... > > /* set of the constants that apply */ > Set getPermissions(); > > /* could be mixed with permissions if we wanted to */ > Boolean isSetUserId(); > Boolean isSetGroupId(); > Boolean hasStickyBit(); > > /* TAR, AR and CPIO know these as well */ > Boolean isSymbolicLink(); > Boolean isRegularFile(); > > // redundant > boolean isDirectory(); > > // unlikely to appear in a real archive but TAR and CPIO support devices > Boolean isSocket(); > Boolean isBlockDevice(); > Boolean isCharacterDevice(); > Boolean isFifo(); > > /* convenience method that re-creates the numeric mode field from > permissions, file flags and bits */ > int asMode(); > > /* TAR and CPIO know these as well */ > Integer getDeviceMajorNumber(); > Integer getDeviceMinorNumber(); > } Hm ...lots of stuff in there. But looks reasonable. Should be all "boolean"s instead of some "Boolean"s thought, right? --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org