Maps the access options before delegating the called operation.
The intended use case of this class is for convenient setting or clearing
of some file system specific access options with a custom file system driver.
For example, let's assume you would like to use the JAR file format with all
entries encrypted according to the WinZip AES specification as your custom
application file format.
Then you could subclass this class as follows:
class EncryptionController extends FsAccessOptionsController EncryptionController(FsController controller) { super(controller); }
\@Override
protected BitField map(BitField options)
return options.set(FsAccessOption.ENCRYPT);
}
}
}
Next, you would have to subclass the
JarDriver in order to inject
an instance of the
EncryptionController as follows:
class EncryptionJarDriver extends JarDriver }
}
Note the call to
super.decorate() - this is required to let the
super class install the built-in key manager.
Now, whenever you use this driver it would encrypt all entries written to
your custom application file format according to the WinZip AES
specification.
Mind that this is just sample code - for encryption, you should generally
prefer the TrueZIP Driver ZIP.RAES for its increased security level!