Package org.jboss.vfs
Class VirtualFileAssembly
- java.lang.Object
-
- org.jboss.vfs.VirtualFileAssembly
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class VirtualFileAssembly extends java.lang.Object implements java.io.Closeable
Assembly of VirtualFiles that can be mounted into the VFS in a structure that is not required to match a real filesystem structure.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
VirtualFileAssembly.AssemblyNode
Node located within the assembly.private static class
VirtualFileAssembly.Path
Path representation to hold onto the elements of the path.
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.io.Closeable>
mountHandles
private VirtualFile
mountRoot
private static java.util.Random
RANDOM_NUM_GEN
private VirtualFileAssembly.AssemblyNode
rootNode
private TempFileProvider
tempFileProvider
-
Constructor Summary
Constructors Constructor Description VirtualFileAssembly()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.String path, java.io.File root)
void
add(java.lang.String path, VirtualFile virtualFile)
Add aVirtualFile
to the assembly in a given path.void
add(VirtualFile virtualFile)
Add aVirtualFile
to the assembly.void
addZip(java.lang.String path, java.io.File zipFile)
void
close()
Close the assembly and nested resources.boolean
contains(VirtualFile mountPoint, VirtualFile target)
private java.lang.String
getAssemblyId()
java.util.List<java.lang.String>
getChildNames(VirtualFile mountPoint, VirtualFile target)
Returns a list of all the names of the children in the assembly.VirtualFile
getFile(VirtualFile mountPoint, VirtualFile target)
Get the VirtualFile from the assembly.private TempFileProvider
getTempFileProvider()
-
-
-
Field Detail
-
RANDOM_NUM_GEN
private static final java.util.Random RANDOM_NUM_GEN
-
rootNode
private final VirtualFileAssembly.AssemblyNode rootNode
-
mountHandles
private final java.util.List<java.io.Closeable> mountHandles
-
mountRoot
private final VirtualFile mountRoot
-
tempFileProvider
private TempFileProvider tempFileProvider
-
-
Method Detail
-
add
public void add(VirtualFile virtualFile)
Add aVirtualFile
to the assembly.- Parameters:
virtualFile
-
-
add
public void add(java.lang.String path, VirtualFile virtualFile)
Add aVirtualFile
to the assembly in a given path.- Parameters:
path
-virtualFile
-
-
add
public void add(java.lang.String path, java.io.File root) throws java.io.IOException
- Throws:
java.io.IOException
-
addZip
public void addZip(java.lang.String path, java.io.File zipFile) throws java.io.IOException
- Throws:
java.io.IOException
-
getFile
public VirtualFile getFile(VirtualFile mountPoint, VirtualFile target)
Get the VirtualFile from the assembly. This will traverse VirtualFiles in assembly to find children if needed.- Parameters:
mountPoint
-target
-- Returns:
- Throws:
java.io.IOException
-
getChildNames
public java.util.List<java.lang.String> getChildNames(VirtualFile mountPoint, VirtualFile target)
Returns a list of all the names of the children in the assembly.- Returns:
-
contains
public boolean contains(VirtualFile mountPoint, VirtualFile target)
-
close
public void close()
Close the assembly and nested resources.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
getTempFileProvider
private TempFileProvider getTempFileProvider() throws java.io.IOException
- Returns:
- Throws:
java.io.IOException
-
getAssemblyId
private java.lang.String getAssemblyId()
-
-