Package org.apache.maven.jxr.pacman
Class FileManager
- java.lang.Object
-
- org.apache.maven.jxr.pacman.FileManager
-
public class FileManager extends java.lang.ObjectSingleton that handles holding references to JavaFiles. This allows Alexandria to lookup and see if a file has already been parsed out and then it can load the information from memory instead of reparsing the file.
Note. This assumes that the file will not be modified on disk while Alexandria is running.
-
-
Constructor Summary
Constructors Constructor Description FileManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFile(JavaFile file)Add a file to this file manager.java.lang.StringgetEncoding()Gets the encoding of source files.JavaFilegetFile(java.nio.file.Path path)Gets a file from its name.
If the file does not exist within the FileManager, creates a new one and returns it.voidsetEncoding(java.lang.String encoding)Sets the encoding of source files.
-
-
-
Field Detail
-
files
private java.util.Map<java.nio.file.Path,JavaFile> files
-
encoding
private java.lang.String encoding
-
-
Method Detail
-
getFile
public JavaFile getFile(java.nio.file.Path path) throws java.io.IOException
Gets a file from its name.
If the file does not exist within the FileManager, creates a new one and returns it.- Parameters:
path- path of the file- Returns:
- the
JavaFilemeta object for the specified file - Throws:
java.io.IOException- on parsing failure
-
addFile
public void addFile(JavaFile file)
Add a file to this file manager.- Parameters:
file- file to add
-
setEncoding
public void setEncoding(java.lang.String encoding)
Sets the encoding of source files.- Parameters:
encoding- encoding of source files
-
getEncoding
public java.lang.String getEncoding()
Gets the encoding of source files.- Returns:
- encoding
-
-