8.2. VFS Architecture
While the public API is quite intuitive, real implementation details add complexity. Some concepts need to be explained in more detail.
Each time you create a VFS instance, its matching
VFSContext
instance is created. This creation is done via VFSContextFactory
. Different protocols map to different VFSContextFactory
instances. For example, file/vfsfile
maps to FileSystemContextFactory
, while zip/vfszip
maps to ZipEntryContextFactory
.
Each time a
VirtualFile
instance is created, its matching VirtualFileHandler is created. This VirtualFileHandler instance knows how to handle different resource types properly; the VirtualFile
API only delegates invocations to its VirtualFileHandler reference.
The
VFSContext
instance knows how to create VirtualFileHandler instances accordingly to a resource type. For example, ZipEntryContextFactory creates ZipEntryContext
, which then creates ZipEntryHandler
.